Highlighting in file attachment with has_child query


(Lar Mader) #1

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' -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' -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


(system) #2