Add custom/predefined aliases to sort values

Hello,
Is there any way to have key => value like sort values as a result?
Where key is sort field name and value is sort value
Currently the sort value result is simply array, which is really inconvenient.

For instance

searchSourceBuilder.sort(SortBuilders.fieldSort("foo").order(SortOrder.ASC))
searchSourceBuilder.sort(SortBuilders.fieldSort("bar").order(SortOrder.ASC))

As a result of hits I am getting following Json

"sort":[
    "743.4643869239765",
    "aa",
    "2dc35909-8c13-4024-a09c-5d375890f811"
]

There is no info about how to do this in Sort Documentation

Thanks.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.