Hello,
I was analysing a generated ES query with hsearch. And the sort generated part is ambigous (it does’nt prevent to work but I don’t understand this generation) :
{
"query":
{...
},
"sort": [
{
"typeSort": {
"order": "asc",
"unmapped_type": "keyword"
}
}
]}
}
What the line "unmapped_type": "keyword"
is doing here ? Indeed the sort field is on a @KeywordField
, here the mapping for each index the search is operating :
@XmlRootElement(name = "ActePrive")
@Entity
@Indexed
@PrimaryKeyJoinColumn(name = "ID")
@Inheritance(strategy = InheritanceType.JOINED)
@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
public class ActePrive extends BasicActePrive implements HasRedacteur, ISearchableParapheur, IQueryableParapheur, ISearchableFormalites, IEntityIndexed {
@Override
@Transient
@KeywordField(name = SearchableParapheurIndexed.TYPE_SORT, sortable = Sortable.YES)
@IndexingDependency(
reindexOnUpdate = ReindexOnUpdate.NO
)
public String getParapheurType() {
return "MICEN";
}
}
The sort is concerning the field SearchableParapheurIndexed.TYPE_SORT
adding it simply to the query :
@Override
protected SortFinalStep sortByField(ElasticsearchSearchSortFactory f) {
FieldSortOptionsStep sortField = f.field(DATE_MODIFICATION);
switch (RechercheParapheurChoixOrderBy.class.cast(configuration.getOrderBy().toChoixOrderBy(RechercheParapheurChoixOrderBy.class))) {
case TYPE:
sortField = f.field(TYPE_SORT);
default:
break;
}
if (RechercheChoixOrderDirection.ASC.equals(configuration.getOrderDirection().toChoixOrderDirection())) {
return f.composite().add((SortFinalStep) sortField.asc());
} else {
return f.composite().add((SortFinalStep) sortField.desc());
}
Any idea ?
Thanks.