Highlight filter queries

Highlight works for the following query. But, i want to highlight the query values present in the filter too. Do i need to entirely change my query structure for that or am i missing out anything in this??

curl "10.237.247.16:9200/cai/_search?pretty=true" -d '{
"query": {
"filtered": {
"query": {
"field": {
"complete": "PATIENT_MERG_2"
}
},
"filter": {
"bool": {
"must": [
{
"query": {
"wildcard": {
"unanalyzedtrace": "23:01:7"
}
}
},
{
"query": {
"wildcard": {
"unanalyzedtrace": "ICP.IR1.MANUALMERGE.IN"
}
}
}
]
}
}
}
},
"highlight": {
"fields": {
"complete": {},
"unanalyzedtrace":{}
}
}
}'

RESPONSE

{
"took" : 90,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [ {
"_index" : "cai",
"_type" : "walgreens",
"_id" : "95f17940-db3b-11e2-bb79-68b5996e3bea",
"_score" : 1.0, "_source" : {"StartDt":"2013-05-01 23:01:7","GroupId":"PATIENT_MERG_2","QueueName":"ICP.IR1.MANUALMERGE.IN","longtime":1367429467000,"estime":"2013-05-01T23:01:07","timeOrginal":"2013-05-01 23:01:7","complete":"2013-05-01 23:01:7,300,PATIENT_MERG_2,ICP.IR1.MANUALMERGE.IN,0,0,0,0,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0","unanalyzedtrace":"2013-05-01 23:01:7,300,PATIENT_MERG_2,ICP.IR1.MANUALMERGE.IN,0,0,0,0,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0"},
"highlight" : {
"complete" : [ "2013-05-01 23:01:7,300,PATIENT_MERG_2,ICP.IR1.MANUALMERGE.IN,0,0,0,0,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0" ]
}
} ]
}
}

When tried to change query to work on 'unanalyzedtrace' instead of 'complete', the whole value gets highlighted.

New Request


"query": {
"wildcard": {
"unanalyzedtrace": "PATIENT_MERG_2"
}
},

Response

{
"took" : 66,
"timed_out" : false,
"_shards" : {
"total" : 5,
"successful" : 5,
"failed" : 0
},
"hits" : {
"total" : 2,
"max_score" : 1.0,
"hits" : [ {
"_index" : "cai",
"_type" : "walgreens",
"_id" : "95f17940-db3b-11e2-bb79-68b5996e3bea",
"_score" : 1.0, "_source" : {"StartDt":"2013-05-01 23:01:7","GroupId":"PATIENT_MERG_2","QueueName":"ICP.IR1.MANUALMERGE.IN","longtime":1367429467000,"estime":"2013-05-01T23:01:07","timeOrginal":"2013-05-01 23:01:7","complete":"2013-05-01 23:01:7,300,PATIENT_MERG_2,ICP.IR1.MANUALMERGE.IN,0,0,0,0,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0","unanalyzedtrace":"2013-05-01 23:01:7,300,PATIENT_MERG_2,ICP.IR1.MANUALMERGE.IN,0,0,0,0,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0"},
"highlight" : {
"unanalyzedtrace" : [ "2013-05-01 23:01:7,300,PATIENT_MERG_2,ICP.IR1.MANUALMERGE.IN,0,0,0,0,0,-1,-1,0,-1,-1,0,-1,-1,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0" ]
}
} ]
}
}

you need use "inner hits" to highlight the content. for example:
"inner_hits": {
"highlight": {
"fields": {
"details":{
"type": "plain",
"force_source" : true,
"fragment_size": 20,
"number_of_fragments": 3
}
}
},
"size":1,
"sort": { "praiseCount": "desc"}
}