# Has\_child query part with highlighting

**URL:** https://discuss.elastic.co/t/has-child-query-part-with-highlighting/12140
**Category:** Elasticsearch
**Created:** [May 28, 2013, 1:46am UTC](https://discuss.elastic.co/t/has-child-query-part-with-highlighting/12140 "2013-05-28T01:46:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Chip\_Kellam](https://avatars.discourse-cdn.com/v4/letter/c/dfb087/32.png) [@Chip\_Kellam](https://discuss.elastic.co/u/Chip_Kellam)
#### Post date: [May 28, 2013, 1:46am UTC](https://discuss.elastic.co/t/has-child-query-part-with-highlighting/12140/1 "2013-05-28T01:46:07Z")

</div>

I have read that it isn't possible (and have tried numerous ways) to get  
highlighting working with a has\_child query.

Is there anything I could do differently to get that working, outside of  
using nested objects?

Example:

{  
"query": {  
"bool": {  
"should": [  
{  
"query\_string": {  
"query": "comment",  
"fields": ["title^2", "body"],  
"use\_dis\_max": true,  
"default\_operator": "and"  
}  
},  
{  
"has\_child": {  
"type": "comment",  
"boost": 1.0,  
"query": { "term": { "body": "comment" } }  
}  
}  
],  
"minimum\_number\_should\_match": 1  
}  
},  
"highlight": {  
"number\_of\_fragments": 1,  
"fragment\_size": 150,  
"pre\_tags" : ["[BHL]"],  
"post\_tags" : ["[EHL]"],  
"fields" : {  
"title": {},  
"body": {}  
}  
}  
}

Thanks,  
Chip

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![nurikabe](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nurikabe/32/2192_2.png) [@nurikabe](https://discuss.elastic.co/u/nurikabe)
#### Post date: [August 6, 2013, 11:09pm UTC](https://discuss.elastic.co/t/has-child-query-part-with-highlighting/12140/2 "2013-08-06T23:09:52Z")

</div>

Just looking for this myself. Pretty sure it's not implemented.

On Monday, May 27, 2013 9:46:07 PM UTC-4, Chip Kellam wrote:

> I have read that it isn't possible (and have tried numerous ways) to get  
> highlighting working with a has\_child query.
> 
> Is there anything I could do differently to get that working, outside of  
> using nested objects?
> 
> Example:
> 
> {  
> "query": {  
> "bool": {  
> "should": [  
> {  
> "query\_string": {  
> "query": "comment",  
> "fields": ["title^2", "body"],  
> "use\_dis\_max": true,  
> "default\_operator": "and"  
> }  
> },  
> {  
> "has\_child": {  
> "type": "comment",  
> "boost": 1.0,  
> "query": { "term": { "body": "comment" } }  
> }  
> }  
> ],  
> "minimum\_number\_should\_match": 1  
> }  
> },  
> "highlight": {  
> "number\_of\_fragments": 1,  
> "fragment\_size": 150,  
> "pre\_tags" : ["[BHL]"],  
> "post\_tags" : ["[EHL]"],  
> "fields" : {  
> "title": {},  
> "body": {}  
> }  
> }  
> }
> 
> Thanks,  
> Chip

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 2:22am UTC](https://discuss.elastic.co/t/has-child-query-part-with-highlighting/12140/3 "2017-07-06T02:22:34Z")

</div>


