Skip to content

Commit 175866d

Browse files
weiqiangyuanmedcl
authored andcommitted
chapter43_part4: /404_Parent_Child/55_Has_parent.asciidoc (#277)
* 完成Parent-Child第4部分的翻译 * revise according comment * revise according comment * save
1 parent 1a1c25a commit 175866d

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed
+8-19
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
[[has-parent]]
2-
=== Finding Children by Their Parents
2+
=== 通过父文档查询子文档
33

4-
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")))
95

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 工作的雇员:
127

138
[source,json]
149
-------------------------
@@ -26,19 +21,13 @@ GET /company/employee/_search
2621
}
2722
}
2823
-------------------------
29-
<1> Returns children who have parents of type `branch`
24+
<1> 返回父文档 `type` 是 `branch` 的所有子文档
3025

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
35-
(`none`).
26+
`has_parent` 查询也支持 `score_mode` 这个参数,((("score_mode parameter")))但是该参数只支持两种值: `none` (默认)和 `score` 。每个子文档都只有一个父文档,因此这里不存在将多个评分规约为一个的情况, `score_mode` 的取值仅为 `score` 和 `none` 。
3627

37-
.Non-scoring has_parent Query
28+
.不带评分的 has_parent 查询
3829
**************************
3930
40-
When used in non-scoring mode (e.g. inside a `filter` clause), the `has_parent`
41-
query no longer supports the `score_mode` parameter. Because it is merely
42-
including/excluding documents and not scoring, the `score_mode` parameter
43-
no longer applies.
31+
当 `has_parent` 查询用于非评分模式(比如 filter 查询语句)时, `score_mode` 参数就不再起作用了。因为这种模式只是简单地包含或排除文档,没有评分,那么 `score_mode` 参数也就没有意义了。
32+
4433
**************************

0 commit comments

Comments
 (0)