# Highlighting in file attachment with has\_child query

**URL:** https://discuss.elastic.co/t/highlighting-in-file-attachment-with-has-child-query/4622
**Category:** Elasticsearch
**Created:** [June 14, 2011, 10:03pm UTC](https://discuss.elastic.co/t/highlighting-in-file-attachment-with-has-child-query/4622 "2011-06-14T22:03:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Lar\_Mader](https://avatars.discourse-cdn.com/v4/letter/l/a6a055/32.png) [@Lar\_Mader](https://discuss.elastic.co/u/Lar_Mader)
#### Post date: [June 14, 2011, 10:03pm UTC](https://discuss.elastic.co/t/highlighting-in-file-attachment-with-has-child-query/4622/1 "2011-06-14T22:03:33Z")

</div>

I have a child document of type "contentFiles" with a field called  
"file" of type attachment. This query successfully returns highlight  
elements.

$ curl -XGET '[http://localhost:9201/foo\_acme/contentFiles/\_search](http://localhost:9201/foo_acme/contentFiles/_search)' -d  
'{"query":{"field":{"file" : "Account"}},"highlight":{"fields":{"file":  
{}}}}'

However when I try to query via the parent type "content" using a  
has\_child query, I get the search results but I don't get the  
highlight elements:

$ curl -XGET '[http://localhost:9201/foo\_acme/content/\_search](http://localhost:9201/foo_acme/content/_search)' -d  
'{"query": {"has\_child":{"type":"contentFiles", "query":{"field":  
{"file" : "Account"}},"highlight":{"fields":{"file":{}}}}}}'

I'm using elasticsearch version 0.16.0? Is this supported, or am I  
doing something wrong?

For completeness, here is my mapping for the contentFiles type, but I  
think the mapping is ok, since my first query works:  
{  
"contentFiles": {  
"\_source" : {  
"enabled" : false  
},  
"\_parent": {  
"type" : "content"  
},  
"properties" : {  
"file" : {  
"type" : "attachment",  
"fields" : {  
"file" : {"store" : "yes", "term\_vector" :  
"with\_positions\_offsets"}  
}  
}  
}  
}  
}

Cheers,  
Lar

---

<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, 4:03am UTC](https://discuss.elastic.co/t/highlighting-in-file-attachment-with-has-child-query/4622/2 "2017-07-06T04:03:36Z")

</div>


