Indexing children before parents - should I be worried?

I'm using Elasticsearch 5.3
Will it cause any issues if a child document is indexed before its parent?
I've come against a situation where its messy to guarantee that the parent already exists. If the parent doesn't exist, it will most likely be coming in the next bulk insert. doesn't seem to warn against indexing children first, and I don't see any errors when I try it out.

I'm just worried that the parent might end up on a different shard.

Can anyone shed light on this concern?

Thank you so much!

As long as you know the parent ID and provide it when you index the child, it's perfectly fine to index a child before the parent. By providing the parent ID when indexing the child, the child is routed to the shard that the parent will also end up on.

1 Like

Fantastic. Saves me a good deal of trouble.
Thank you!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.