I have to sort on a field that is one level nested using the elastic java high level rest client api. I could find this answer
The problem is that the answer uses SortBuilder for sorting nested fields using the following code :
SortBuilder sb = SortBuilders.fieldSort("authorList.lastName")
.order(SortOrder.ASC)
.setNestedPath("authorList")
.setNestedFilter(matchFirst);
However it seems that nestedPath and NestedFilter have been deprecated in 6.3.2 elastic (deprication info)and a new NestedSortBuilder has been introduced. However I was not able to build a query using it. Can anyone please explain how to use it or perhaps point me to an example where it has been used?
Actually was easy. This works for me :
This is equivalent to :