Implementing a parent-child relationship and changing parent of a child document

Hello,

We need to create a solution able to search for two entities: record and file. Each one has its properties and records can have zero or more files.

Appears to be very simple, but I am finding very difficult to find an easy answer in Elasticsearch.
After some research, I concluded that I should use join fields to create a parent-child relationship. Then, the first yellow flag is raised: the documentation says that it could have poor performance.

"The only case where the join field makes sense is if your data contains a one-to-many relationship where one entity significantly outnumbers the other entity"

We have a larger number of files compared to records, but it certainly do not "significantly outnumbers"... But OK... I guess. I am not sure what to expect from this poor performance.

The second yellow flag is that we can change the record of a file. And that can cause the file to go to a different shard? I found a topic saying that I should delete the child and then creating it again with a different parent. Is that really the way to achieve that?

Any help would be greatly appreciated.

How frequently are records updated? How many primary shards will your index have?

1 Like

Records (and files) can change frequently. As for the number of shards, I am not really sure. Sometimes I think of using only one just to be easier to maintain.

NOTE: We already use Elasticsearch today, but the index only have one entity (files).
Currently, it has 300 GB and 1 shard.