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
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
是的,您可以对 child 执行标准 GET index
,type
并且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
答:需要添加带有父ID的路由参数来检索子记录。