You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While a `nested` query can always ((("parent-child relationship", "finding children by their parents")))return only the root document as a result,
5
-
parent and child documents are independent and each can be queried
6
-
independently. The `has_child` query allows us to return parents based on
7
-
data in their children, and the `has_parent` query returns children based on
8
-
data in their parents.((("has_parent query and filter", "query")))
4
+
虽然 `nested` 查询只能返回最顶层的文档 ((("parent-child relationship", "finding children by their parents"))),但是父文档和子文档本身是彼此独立并且可被单独查询的。我们使用 `has_child` 语句可以基于子文档来查询父文档,使用 `has_parent` 语句可以基于子文档来查询父文档。 ((("has_parent query and filter", "query")))
9
5
10
-
It looks very similar to the `has_child` query. This example returns
11
-
employees who work in the UK:
6
+
`has_parent` 和 `has_child` 非常相似,下面的查询将会返回所有在 UK 工作的雇员:
12
7
13
8
[source,json]
14
9
-------------------------
@@ -26,19 +21,13 @@ GET /company/employee/_search
26
21
}
27
22
}
28
23
-------------------------
29
-
<1> Returns children who have parents of type`branch`
24
+
<1> 返回父文档 `type` 是 `branch` 的所有子文档
30
25
31
-
The `has_parent` query also supports the `score_mode`,((("score_mode parameter"))) but it accepts only two
32
-
settings: `none` (the default) and `score`. Each child can have only one
33
-
parent, so there is no need to reduce multiple scores into a single score for
34
-
the child. The choice is simply between using the score (`score`) or not
0 commit comments