2

I simply would like to GET the child record directly after inserting both the Parent and the Child. Must I do a search query to just get the child or can I just do a standard GET with just the index, type, id of the child record?

thanks

4

2 回答 2

2

是的,您可以对 child 执行标准 GET indextype并且id,但是正如user983022提到的,您需要在请求中使用 theparent_id作为routing参数,否则 ES 可能会为子文档查找错误的分片。

有关父/子和路由的更多信息,请阅读http://www.elasticsearch.org/blog/customizing-your-document-routing/http://www.elasticsearch.org/guide/reference/api/get/提到在请求中使用routing参数。GET

于 2013-08-18T15:48:38.537 回答
1

答:需要添加带有父ID的路由参数来检索子记录。

于 2013-08-18T15:21:06.337 回答