Looking for a way to structure nested or relational data in elastic search
See original GitHub issueI’m looking for a way to structure nested or relational data in elastic search.
Ex. A cluster of chain restaurants that are separated by regions. But these regions group together locations/addresses is what I had in mind. However this would mean I would have to update the entire document when locations are added or deleted.
I read the following guides and think the best way is to index location/address and then add the name of the restaurant chain to the index document. I’m looking to do a query search one string if possible.
q = 'chipotle san francisco'
s = Search(using=client, index="restaurants").filter("term",name=q)
r = s.execute()
for h in r:
print h # this would be listing all chipotle restaurants in san francisco area.
However, the documentation provided here does not say how to persist data with nests or relational data here. What would be the better way to index this sort of structure? I’m not sure if elastic search can do joining like RMDBS. (e.g postgresql) Please advise.
Thanks!
Reference:
https://www.elastic.co/blog/managing-relations-inside-elasticsearch http://stackoverflow.com/questions/23403149/elasticsearch-relationship-mappings-one-to-one-and-one-to-many http://voormedia.com/blog/2014/06/four-ways-to-index-relational-data-in-elasticsearch
Issue Analytics
- State:
- Created 7 years ago
- Comments:13 (7 by maintainers)
Top GitHub Comments
@rlam3 simpluy pass a
score_mode
parameter to thehas_parent
orhas_child
query:Yes, use a
has_parent
query which will query the children and then you can use it’sscore_mode
parameter to influence how the parent score will influence the child’s