-
Notifications
You must be signed in to change notification settings - Fork 1.5k
chapter43_part2: /404_Parent_Child/45_Indexing_parent_child.asciidoc #273
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
chapter43_part2: /404_Parent_Child/45_Indexing_parent_child.asciidoc #273
Conversation
@@ -27,31 +25,19 @@ PUT /company/employee/1?parent=london <1> | |||
"hobby": "hiking" | |||
} | |||
------------------------- | |||
<1> This `employee` document is a child of the `london` branch. | |||
<1> 当前 `employee` 文档的父文档 ID 是 `london` 。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 当前改为这个
In <<routing-value>>, we explained how Elasticsearch uses a routing value, | ||
which defaults to the `_id` of the document, to decide which shard a document | ||
should belong to. The routing value is plugged into this simple formula: | ||
在 <<routing-value>> 中,我们解释了 Elasticsearch 如何通过对某一个值进行路由,来决定该文档属于哪一个分片,路由值默认为该文档的 `_id` 。分片路由的计算公式如下: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 通过对某一个值进行路由改为路由值,和后面对应
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
instead of the `_id`. In other words, both the parent and the child use the | ||
same routing value--the `_id` of the parent--and so they are both stored | ||
on the same shard. | ||
如果指定了父文档的 ID,那么就会使用父文档的 ID 进行路由,而不会使用当前文档 `_id` 。也就是说,如果父文档和子文档都使用相同的值进行路由,那么父文档和子文档都会确定分布在同一个分片上。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 去掉如果
forwarded to all shards in an index, these single-document requests are | ||
forwarded only to the shard that holds the document--if the `parent` ID is | ||
not specified, the request will probably be forwarded to the wrong shard. | ||
在执行如下请求时需要知道父文档的 ID:通过 `GET` 请求获取一个子文档时;创建、更新或删除一个子文档时。而执行搜索请求时是不需要指定父文档的ID,这是因为搜索请求是向一个索引中的所有分片发起请求,而单文档的操作是只会向存储该文档的分片发送请求。因此,如果操作单个子文档时,如果不知道父文档的 ID,那么很有可能会把请求发送到错误的分片上。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 在执行如下对单个子文档的所有请求时需要指定父文档 ID
- 索引、更新或删除
- 不像搜索请求会被转发到索引的所有分片上,而对单个子文档的请求只会转发到存储该文档的分片。如果没有指定父文档的 ID ,请求可能会转发到错误的分片。(这么翻译可能相对简洁些)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这段话参考你的建议,做了一些优化
|
||
The `parent` ID should also be specified when using the `bulk` API: | ||
父文档的 ID 也可以在 `bulk` API 中指定 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 可以改为应该
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已修改
document may be on a different shard. Instead, you must first delete the old | ||
child, and then index the new child. | ||
|
||
WARNING: 如果你想要改变一个子文档的 `parent` ,仅通过更新这个子文档是不够的,因为新的父文档有可能在另外一个分片上。因此,你必须要先把子文档删除,然后再重新索引这个文档。 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 子文档的
parent
值 - 重新索引这个子文档
LGTM |
LGTM |
…lasticsearch-cn#273) * 完成Parent-Child第二章的翻译 * revise acording pr first review * revise pc * add desc for single doc * revise type
完成Parent-Child章中第二节的翻译:Indexing Parents and Children