Hi,
I would like to know if it would be posible the relation grate-grandparent/grate-grandchild so It exists too the relations parent/child and grandparent/grandchild in elasticsearch.
Thanks in advance.
Best regards
Juan
Hi,
I would like to know if it would be posible the relation grate-grandparent/grate-grandchild so It exists too the relations parent/child and grandparent/grandchild in elasticsearch.
Thanks in advance.
Best regards
Juan
Yes it is possible, take a look at this seciton of the Elasticsearch:The Definitive Guide book: https://www.elastic.co/guide/en/elasticsearch/guide/current/grandparents.html
Yes but here It´s talking about to three generations. I want to say more than three generations:
Grate-GrandParent => Grand Parent => Parent => Child
Because in the documentation it is talking about the three generations specifying in the routing parameter from the creation of the child the Grand Parent to in this way all it will in the same shard. It is specifying routing = Grand Parent id.
But my question is what about the Grate-GrandParent, how could I specify this? What is the parameter? Is it possible to use so much generations so we want (more than 3 to N generations).
Thanks in advance.
It should work, you will just need to make sure you set the routing parameter to always point to the highest-generation (in the 4 generation case, the great-grandparent) so that all documents related to each other are on the same shard.
However, as far a I know this is un-tested so you will need to perform your own tests to make this work.
You also need to bear in mind that you run the risk of having un-evenly balanced shards (number of documents on each shard differs greatly) with this approach especially if the number of children of each generation varies between great-grandparents. The more generations you have the more susceptible to this you will be.
Lastly, each generation has an overhead cost in memory use. To make the queries efficient we need to store a data structure in memory which identifies the parent documents of each generation. Each generation you add in your index will add a new data structure which will cost memory. Note that this memory is (effectively) linear with the number of documents on the shard and not with the number of parent documents at that level.
Ok, I will take in account.
Thanks for your reply. I am so grateful by your help.
© 2020. All Rights Reserved - Elasticsearch
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant logo are trademarks of the Apache Software Foundation in the United States and/or other countries.