Description
Hello, after trying to upgrade to the latest version 5.4.4 it seems that sorting by inner fields is no longer working at all. This change of behavior is caused by the adjustments made in #3074.
Until now we had the following part in a separate mapping.json
with no annotations at all on the name
property in our User class:
{
"user": {
"aliases": {},
"mappings": {
"properties": {
[..]
"name": {
"type": "text",
"fields": {
"raw": {
"type": "keyword"
}
},
"analyzer": "autocomplete",
"search_analyzer": "standard"
},
[..]
The inner field name.raw
is used for sorting purposes only, like in repository.findAll(Sort.by("name.raw")
.
Now the added manipulation of sort parameters added in MappingElasticsearchConverter.updatePropertiesInFieldsSortAndSourceFilter
removes the .raw
part from the sort parameter, which causes the whole query to fail as text fields are not optimised for sorting and therefore the operation is disabled by default.
I already tried moving the field information from the mapping.json
directly to the class like the following, which created the correct mapping during index recreation, but the sort manipulation is still happening as if the model is not aware of its own inner field:
@MultiField(
mainField = @Field(type = FieldType.Text, analyzer = "autocomplete", searchAnalyzer = "standard"),
otherFields = @InnerField(suffix = "raw", type = FieldType.Keyword))
String name;
Am I missing something or is there no way to sort by name.raw
now in the latest version?