Hello,
I am using elasticsearch v5.5, and trying to build a sort query, sorted by 3 level nested field.
In https://www.elastic.co/guide/en/elasticsearch/reference/5.5/search-request-sort.html, there is an example on sorting by 2 level nested field.
POST /_search
{
"query" : {
"term" : { "product" : "chocolate" }
},
"sort" : [
{
"offer.price" : {
"mode" : "avg",
"order" : "asc",
"nested_path" : "offer",
}
}
]
}
And to convert to Java, it is like
FieldSortBuilder sortBuilder = new FieldSortBuilder("offer.price").order(SortOrder.ASC)
.setNestedPath("offer");
What if I want to sort by 3 level nested field (say: parent.child.age) in elasticsearch v5.5? And what is the corresponding Java builder format?
Thanks!
P.S. I saw multi-level nested sorting example (sort by parent.child.age, which is a 3 level sort) on elasticsearch v6.1 and onward. Can you also provide an example on v5.5