If parent has multiple childs and child can also have multiple parents


(Jay) #1

Hi, I am new to elasticsearch and I read the other posts saying that Multiple parents for children are not supported by ES.

I have a case where the actual data which I want to search lies in the parent.

For example:

Account- parent having

Multiple Children behaviors could be- Entity, Document, Event.

Business - parent having

Multiple Children behaviors could be- Entity, Document

In this case, I will end up with n*n relationships.

I just want to do a check whether Business is an entity or an event or a document. I do not want to retrieve any information from the child table and the same goes for Account type.

Is there a provision in ES to do the above thing?

Any help on this will be much appreciated.


(Mark Walkom) #2

That is correct.

Assuming that this is a simple tag/value in a doc, a filter would do.


(Jay) #3

Hi Mark, thanks for your reply!!

Moving ahead, I wrote a search query, which does the search over every Type which has the children of type "Event" and return the search results over that type. But this query did not return any results

GET Hunter/_search
{
   "from": 0,
   "size": 2147483647,
   "query": {
      "has_child": {
         "type": "Event",
         "query": {
            "query_string": {
               "fields": [
                  "Name_text"
               ],
               "query": "a*"
            }
         }
      }
   }
}

If I write the same query without the has_child clause I got 40 hits. Where am I going wrong in this?
Note: I did not add any data to the Event type. I just added the mapping for it.


(system) #4