Parent-child highlighting

In a parent, child doc mapping, is it possible to highlight the
matches in the child document?

I doubt it is an open issue : https://github.com/elasticsearch/elasticsearch/issues/1764

On May 15, 11:12 am, nmz s.namith...@gmail.com wrote:

In a parent, child doc mapping, is it possible to highlight the
matches in the child document?

Its not possible as of now.
You will have to do the task in 2 web calls.
First one which runs the has_children query. Here you need to collect the
docid.
Second web call should have _parent with all the matching doc ID previously
gathered

Thanks
Vineeth

On Tue, May 15, 2012 at 3:40 PM, nmz s.namitha.s@gmail.com wrote:

I doubt it is an open issue :
https://github.com/elasticsearch/elasticsearch/issues/1764

On May 15, 11:12 am, nmz s.namith...@gmail.com wrote:

In a parent, child doc mapping, is it possible to highlight the
matches in the child document?

In a should query I'm doing the following to highlight the children hits. However I'm experiencing som issues highlighting the hits from the parent at the same time - but hope this will solve your issues.

You can leave the filters - they are only for the purpose of fetching the active children in my setup.

"query": {
"bool": {
"should": [
{
"has_child": {
"type": "TYPE",
"score_mode": "max",
"query": {
"filtered": {
"query": {
"multi_match": {
"query": "QUERY",
"fields": ["CHILD_FIELD_1", "CHILD_FIELD_2"]
}
},
"filter": {
"term": {
"active": true
}
}
}
},
"inner_hits":{
"highlight": {
"fields": {
"CHILD_FIELD_1": {}
}
}
}
}
}
]
}
}

1 Like