elastic search - how to query the child resource

160 Views Asked by At

I have a resource

GET /parents/{Id}

this one I can see the alias in elastic search, I am able to retrieve data in ES by doing this : (GET parents_alias/parent/5/)

However with this resource 2/ For /parents/{Id}/comment/{commentId} I do not have an alias I do not know how to query in ES in order to get comment

any idea?

1

There are 1 best solutions below

0
shan On

If you are trying to create a parent child association in elasticsearch I believe you need to first create the parent-child mapping as explained here - https://www.elastic.co/guide/en/elasticsearch/guide/master/parent-child-mapping.html

Also you can get parent records if you know child details and vice versa. More details here - https://www.elastic.co/guide/en/elasticsearch/guide/master/has-child.html

https://www.elastic.co/guide/en/elasticsearch/guide/master/has-parent.html