20

have two objects: humans and belongings. I want to specify a _parent of a belonging to be a specific human. ElasticSearch provides this ability via the _parent mapping. However the documentation and most examples I've found are all doing this from within the SAME index.

But if I had a humans index, and a belongings index, I'm wondering if I am able to specify the parent relationship across indexes. Preliminary tests seem to point to NO.

Furthermore, my theory is that you cannot do this because it would result in the human always being on a different shard as the belonging (different indexes, different shards). We know from the documentation that the human id is used to route the child (upon indexing) to the same shard as the human. This is for efficiency purposes (in memory joins, round trips, etc). But that cannot occur since we're talking about different shards altogether.

QUESTION #1: Does anyone know if _parent can be specified across indexes?

And if so,

QUESTION #2: How is the routing issues I mentioned resolved internally?

Koen.
  • 25,449
  • 7
  • 83
  • 78
Tyler Kasten
  • 243
  • 2
  • 8

2 Answers2

14

You are correct in saying "different index, different shard" - meaning the answer to question #1 is no. With that, #2 cannot be answered.

James Addison
  • 3,086
  • 1
  • 17
  • 16
2

2020 Update - ElasticSearch 7.8

As mentioned in the docs link https://www.elastic.co/guide/en/elasticsearch/reference/current/parent-join.html

The join data type is a special field that creates parent/child relation within documents of the same index.

This means that both parent/child must be in the SAME index.

Yousuf Khan
  • 334
  • 3
  • 12