Multi-level nested sort in elasticsearch v5.5

I am using elasticsearch v5.5, and trying to build a sort query, sorted by 3 level nested field.
In, 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)

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?


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

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