瀏覽代碼

Fix test failures.

Isabel Drost-Fromm 9 年之前
父節點
當前提交
6d5e24726f

+ 13 - 22
docs/reference/query-dsl/geo-polygon-query.asciidoc

@@ -10,7 +10,7 @@ GET /_search
 {
     "query": {
         "bool" : {
-            "query" : {
+            "must": {
                 "geo_polygon" : {
                     "person.location" : {
                         "points" : [
@@ -59,9 +59,6 @@ GET /_search
     "query": {
         "bool" : {
             "must" : {
-                "match_all" : {}
-            },
-            "filter" : {
                 "geo_polygon" : {
                     "person.location" : {
                         "points" : [
@@ -90,19 +87,16 @@ GET /_search
     "query": {
         "bool" : {
             "must" : {
-                "match_all" : {}
-            },
-                "filter" : {
-                    "geo_polygon" : {
-                        "person.location" : {
-                            "points" : [
-                                "40, -70",
+                "geo_polygon" : {
+                    "person.location" : {
+                        "points" : [
+                            "40, -70",
                             "30, -80",
                             "20, -90"
-                            ]
-                        }
+                        ]
                     }
                 }
+            }
         }
     }
 }
@@ -119,19 +113,16 @@ GET /_search
     "query": {
         "bool" : {
             "must" : {
-                "match_all" : {}
-            },
-                "filter" : {
-                    "geo_polygon" : {
-                        "person.location" : {
-                            "points" : [
-                                "drn5x1g8cu2y",
+                "geo_polygon" : {
+                    "person.location" : {
+                        "points" : [
+                            "drn5x1g8cu2y",
                             "30, -80",
                             "20, -90"
-                            ]
-                        }
+                        ]
                     }
                 }
+            }
         }
     }
 }

+ 14 - 16
docs/reference/query-dsl/nested-query.asciidoc

@@ -12,10 +12,12 @@ will work with:
 --------------------------------------------------
 PUT /my_index
 {
-    "type1" : {
-        "properties" : {
-            "obj1" : {
-                "type" : "nested"
+    "mappings": {
+        "type1" : {
+            "properties" : {
+                "obj1" : {
+                    "type" : "nested"
+                }
             }
         }
     }
@@ -33,19 +35,15 @@ GET /_search
     "query": {
         "nested" : {
             "path" : "obj1",
-                "score_mode" : "avg",
-                "query" : {
-                    "bool" : {
-                        "must" : [
-                        {
-                            "match" : {"obj1.name" : "blue"}
-                        },
-                        {
-                            "range" : {"obj1.count" : {"gt" : 5}}
-                        }
-                        ]
-                    }
+            "score_mode" : "avg",
+            "query" : {
+                "bool" : {
+                    "must" : [
+                    { "match" : {"obj1.name" : "blue"} },
+                    { "range" : {"obj1.count" : {"gt" : 5}} }
+                    ]
                 }
+            }
         }
     }
 }

+ 34 - 6
docs/reference/query-dsl/parent-id-query.asciidoc

@@ -3,32 +3,60 @@
 
 added[5.0.0]
 
-The `parent_id` query can be used to find child documents which belong to a particular parent:
+The `parent_id` query can be used to find child documents which belong to a
+particular parent. Given the following mapping definition:
 
 [source,js]
 --------------------------------------------------
 PUT /my_index
 {
-    "parent_id" : {
-        "type" : "blog_tag",
-        "id" : "1"
+    "mappings": {
+        "blog_post": {
+            "properties": {
+                "name": {
+                    "type": "keyword"
+                }
+            }
+        },
+        "blog_tag": {
+            "_parent": {
+                "type": "blog_post"
+            },
+            "_routing": {
+                "required": true
+            }
+        }
     }
 }
 --------------------------------------------------
 // CONSOLE
 // TESTSETUP
 
+[source,js]
+--------------------------------------------------
+GET /_search
+{
+    "query": {
+        "parent_id" : {
+            "type" : "blog_tag",
+                "id" : "1"
+        }
+    }
+}
+--------------------------------------------------
+// CONSOLE
+
 The above is functionally equivalent to using the following
 <<query-dsl-has-parent-query, `has_parent`>> query, but performs
 better as it does not need to do a join:
 
 [source,js]
 --------------------------------------------------
-GET /_search
+GET /my_index/_search
 {
     "query": {
         "has_parent": {
-            "type": "blog",
+            "type": "blog_post",
                 "query": {
                     "term": {
                         "_id": "1"