Nested example from documentation


(Vladimír Čamaj) #1

Hello, I am starting with Elastic and now I am reading about nested sorting. https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-sort.html#_nested_sorting_examples There is an example code which looks like:

POST /_search
{
   "query": {
      "nested": {
         "path": "parent",
         "query": {
            "bool": {
                "must": {"range": {"parent.age": {"gte": 21}}},
                "filter": {
                    "nested": {
                        "path": "parent.child",
                        "query": {"match": {"parent.child.name": "matt"}}
                    }
                }
            }
         }
      }
   },
   "sort" : [
      {
         "parent.child.age" : {
            "mode" :  "min",
            "order" : "asc",
            "nested": {
               "path": "parent",
               "filter": {
                  "range": {"parent.age": {"gte": 21}}
               },
               "nested": {
                  "path": "parent.child",
                  "filter": {
                     "match": {"parent.child.name": "matt"}
                  }
               }
            }
         }
      }
   ]
}

There is no structure of document on which this query will work. I am new in it. I cant imagine the object structure from the query. Simple queries have PUT examples before. But this huge query object has not?
Can somebody write me the PUT example for this query? (also to the documentation). Thanks.


(system) #2

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