I want to explicitly order highlighted fields using the Elasticsearch Java API Client 7.16.
In other words I want to build the following request
GET /_search
{
"highlight": {
"fields": [
{ "a": {} },
{ "b": {} },
{ "c": {} }
]
}
}
Unfortunately the following code ignores the insertion order:
new Highlight.Builder()
.fields("a", new HighlightField.Builder().build())
.fields("b", new HighlightField.Builder().build())
.fields("c", new HighlightField.Builder().build());
Actually all available fields() methods eventually put the data in the unordered map. So my request actually is following:
GET /_search
{
"highlight": {
"fields": {
"b": {},
"c": {},
"a": {}
}
}
}
Is there any other Java API that allows to control the order of highlighted fields?