Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
416 views
in Technique[技术] by (71.8m points)

relationship - ElasticSearch Parent Join duplicate parent specification

The elastic search documentation for Parent-Child joins makes clear it is required to include the ID of the parent document in the routing so that the child document ends up in the same shard.

The specification of the join field in the child object also includes this relationship data.

Why does the parent document need to be specified twice, and why does the Elastic API accept documents where the two instances of this link are different?

Parent Child Join Documentation

PUT my-index-000001/_doc/3?routing=1&refresh 
{
  "my_id": "3",
  "text": "This is an answer",
  "my_join_field": {
    "name": "answer", 
    "parent": "1" 
  }
}

In the above example both the routing=1 and the "parent" : "1" specify the parent document ID for this child. If the json document contains "parent" : "2" while maintaining the routing=1 the insert is accepted, but the resultant child document doesn't appear to be retrievable using has_child or has_parent queries.

question from:https://stackoverflow.com/questions/65924111/elasticsearch-parent-join-duplicate-parent-specification

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...