Query docs with circular references

New to writing ES queries and have a docs like:

     "state" : "california",
     "relation" : "neighour_right",
     "related_state" : "arizona"
     "state" : "arizona",
     "relation" : "neighour_left",
     "related_state" : "california"

How do query the index to find the docs that have circular references like the above?


That ain't possible. Elasticsearch does not handles relationships like that. At most, it can do hierarchical relationship (1-N) using either Nested or Parent/Child mappings. Refer to the following for more information about relationships in Elasticsearch: https://www.elastic.co/guide/en/elasticsearch/guide/current/relations.html

Thanks, will look into loading into some relational db and find the way out.

Can Graph do something like that?

Graph would return a graph-like structure at term and document count level only. It doesn't turns Elasticsearch into a graph database.

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