Skip to content

chapter43_part4: /404_Parent_Child/55_Has_parent.asciidoc #277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 22, 2016

Conversation

weiqiangyuan
Copy link

No description provided.

independently. The `has_child` query allows us to return parents based on
data in their children, and the `has_parent` query returns children based on
data in their parents.((("has_parent query and filter", "query")))
`nested` query 只能返回最顶层的文档 ((("parent-child relationship", "finding children by their parents"))),而在父-子文档中,父文档和子文档都是独立的,并且可以被单独地查询出来。`has_child` 实现了根据子文档的数据内容来查询父文档,类似我们也有 `has_parent` ,实现了根据父文档的数据内容来查询子文档((("has_parent query and filter", "query")))。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改为

虽然 nested query 只能返回父级文档,但是父子文档本身是彼此独立并且可被单独查询的。

是否更通顺一些?

我们使用 has_child 语句可以基于子文档来查询父文档,使用 has_parent 语句可以基于子文档来查询父文档。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,按照要求修改

@@ -26,19 +21,13 @@ GET /company/employee/_search
}
}
-------------------------
<1> Returns children who have parents of type `branch`
<1> 指定子文档对应的父文档 type `branch`

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

按照原意 翻译会更好一些吧

返回父文档 type 是 branch 的所有子文档

😄

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,按照要求修改

parent, so there is no need to reduce multiple scores into a single score for
the child. The choice is simply between using the score (`score`) or not
(`none`).
`has_parent` query 也支持 `score_mode` 这个参数,((("score_mode parameter")))但是该参数只支持两种值: `none` (默认)和 `score` 。因为每一个子文档都只有一个父文档,对子文档而言并不需要在多个评分中进行筛选,因此 `score_mode` 就很简单,取值仅为 `score` 和 `none` 。
Copy link

@rockybean rockybean Oct 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个query 是否应该翻译为中文?

下面这个改成如下是否更通顺?

每个子文档都只有一个父文档,因此这里不存在将多个评分规约为一个的情况,取值仅为 使用分数 ( score ) 和不用( none )。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,按照要求修改

query no longer supports the `score_mode` parameter. Because it is merely
including/excluding documents and not scoring, the `score_mode` parameter
no longer applies.
当不需要评分时(例如:在一个 `filter` 查询语句中),`has_parent` 不支持 `source_mode` 参数。因为 filter 查询的结果仅是存在或者不存在并且不需要评分,因此 `source_mode` 这个参数也就不需要了。

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has_parent 查询用于非评分模式(比如 filter 查询语句)时,score_mode参数不再起作用。因为这种模式只是简单地包含或排除文档,没有评分,那么 score_mode 参数也就没有意义了。

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok,按照要求修改

@rockybean
Copy link

LGTM

independently. The `has_child` query allows us to return parents based on
data in their children, and the `has_parent` query returns children based on
data in their parents.((("has_parent query and filter", "query")))
虽然 `nested` 查询只能返回最顶层的文档 ((("parent-child relationship", "finding children by their parents"))),但是父文档和子文档本身是彼此独立并且可被单独查询的。我们使用 `has_child` 语句可以基于子文档来查询父文档,使用 `has_parent` 语句可以基于子文档来查询父文档。。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

少了一个这个 ((("has_parent query and filter", "query"))), 其他都 OK

@medcl medcl merged commit 175866d into elasticsearch-cn:cn Oct 22, 2016
@medcl
Copy link
Member

medcl commented Oct 22, 2016

LGTM

tangmisi pushed a commit to tangmisi/elasticsearch-definitive-guide that referenced this pull request Oct 31, 2016
…rch-cn#277)

* 完成Parent-Child第4部分的翻译

* revise according comment

* revise according comment

* save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants