From 2c36ead4e1648c1d5e0a5aea7b6e1970de6b7b73 Mon Sep 17 00:00:00 2001 From: "weiqiang.yuan" Date: Sun, 11 Sep 2016 18:24:39 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=AE=8C=E6=88=90Parent-Child=E7=AC=AC5?= =?UTF-8?q?=E9=83=A8=E5=88=86=E7=9A=84=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 404_Parent_Child/60_Children_agg.asciidoc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/404_Parent_Child/60_Children_agg.asciidoc b/404_Parent_Child/60_Children_agg.asciidoc index 6af80f0ec..887a6a0a8 100644 --- a/404_Parent_Child/60_Children_agg.asciidoc +++ b/404_Parent_Child/60_Children_agg.asciidoc @@ -1,14 +1,10 @@ [[children-agg]] -=== Children Aggregation +=== 子文档聚合 -Parent-child supports a -http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-children-aggregation.html[`children` aggregation] as ((("aggregations", "children aggregation")))((("children aggregation")))((("parent-child relationship", "children aggregation")))a direct analog to the `nested` aggregation discussed in -<>. A parent aggregation (the equivalent of -`reverse_nested`) is not supported. - -This example demonstrates how we could determine the favorite hobbies of our -employees by country: +在父-子文档中,支持 +http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-children-aggregation.html[子文档聚合],这一点和((("aggregations", "children aggregation")))((("children aggregation")))((("parent-child relationship", "children aggregation"))) <> 类似。但是,对于父文档的聚合查询是不支持的(和 `reverse_nested` 类似)。 +如下查询展示了如何在不同国家下,按照雇员爱好的维度进行聚合查询: [source,json] ------------------------- GET /company/branch/_search @@ -37,7 +33,6 @@ GET /company/branch/_search } } ------------------------- -<1> The `country` field in the `branch` documents. -<2> The `children` aggregation joins the parent documents with - their associated children of type `employee`. -<3> The `hobby` field from the `employee` child documents. +<1> `country` 是 `branch` 的一个字段。 +<2> 对子文档的聚合查询结果和对父文档的聚合查询结果,是通过 `employee` type 关联起来的。 +<3> `hobby` 是 `employee` 子文档的一个字段。 From 2c444bb59ef2bf7d8322222452a8e532ee01412a Mon Sep 17 00:00:00 2001 From: "weiqiang.yuan" Date: Wed, 19 Oct 2016 01:18:11 +0800 Subject: [PATCH 2/2] revise according comment --- 404_Parent_Child/60_Children_agg.asciidoc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/404_Parent_Child/60_Children_agg.asciidoc b/404_Parent_Child/60_Children_agg.asciidoc index 887a6a0a8..0363fa2e6 100644 --- a/404_Parent_Child/60_Children_agg.asciidoc +++ b/404_Parent_Child/60_Children_agg.asciidoc @@ -1,10 +1,10 @@ [[children-agg]] === 子文档聚合 -在父-子文档中,支持 +在父-子文档中支持 http://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-children-aggregation.html[子文档聚合],这一点和((("aggregations", "children aggregation")))((("children aggregation")))((("parent-child relationship", "children aggregation"))) <> 类似。但是,对于父文档的聚合查询是不支持的(和 `reverse_nested` 类似)。 -如下查询展示了如何在不同国家下,按照雇员爱好的维度进行聚合查询: +我们通过下面的例子来演示按照国家维度查看最受雇员欢迎的业余爱好: [source,json] ------------------------- GET /company/branch/_search @@ -33,6 +33,6 @@ GET /company/branch/_search } } ------------------------- -<1> `country` 是 `branch` 的一个字段。 -<2> 对子文档的聚合查询结果和对父文档的聚合查询结果,是通过 `employee` type 关联起来的。 +<1> `country` 是 `branch` 文档的一个字段。 +<2> 子文档聚合查询通过 `employee` type 的子文档将其父文档聚合在一起。 <3> `hobby` 是 `employee` 子文档的一个字段。