# Inconsistency in Search Highlight results

**URL:** <https://discuss.elastic.co/t/inconsistency-in-search-highlight-results/49769>\
**Category:** Elasticsearch\
**Created:** [May 11, 2016, 1:28pm UTC](https://discuss.elastic.co/t/inconsistency-in-search-highlight-results/49769 "2016-05-11T13:28:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arnaud\_Babilone](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arnaud_babilone/32/7416_2.png) [@Arnaud\_Babilone](https://discuss.elastic.co/u/Arnaud_Babilone)\
**Post date:** [May 11, 2016, 1:28pm UTC](https://discuss.elastic.co/t/inconsistency-in-search-highlight-results/49769/1 "2016-05-11T13:28:20Z")

</div>

Hi everyone,

We are facing a strange behavior regarding highlighted search result. We currently use elasticsearch 1.7.3.  
We are searching on a nested field and get the result as expected, but not highlight information are returned by elasticsearch.

If we include a match, of the same search term, on another "root" field of the searched document, we get the highlight information for our other field.

Here are the two search and their associated result:

_Not working query:_

`{ "highlight": { "fields": { "*": {} } }, "query": { "bool": { "should": [{ "nested": { "query": { "match": { "keywords.value": { "query": "testabb2" } } }, "path": "keywords" } }] } } }`

_Not working result:_

`{ "took" : 2, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 1, "max_score" : 3.451458, "hits" : [{ "_index" : "pouetpouet", "_type" : "mediaasset", "_id" : "9001d270-c192-11e4-9ddf-003048be8676", "_score" : 3.451458, "_source" : { "id" : "9001d270-c192-11e4-9ddf-003048be8676", "creationDate" : "2015-03-03T10:46:36Z", "parentMediaAssetId" : "9001d270-c192-11e4-9ddf-003048be8676", "mediaResourcesIds" : ["73a853ff-e992-46ba-be11-c24f13d18ab4"], "name" : "yo coucou", "keywords" : [{ "id" : "dd7dec78-aaf6-472e-98a5-475a6a6b22aa", "type" : "Keyword", "value" : "testabb2" }], "updatedDate" : "2016-05-10T10:54:38.917" } } ] } }`

_Working query_

`{ "highlight": { "fields": { "*": {} } }, "query": { "bool": { "should": [{ "nested": { "query": { "match": { "keywords.value": { "query": "testabb2" } } }, "path": "keywords" } }, { "match": { "name": { "query": "testabb2" } } }] } } }`

_Working result_

`{ "took" : 2, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 1, "max_score" : 3.451458, "hits" : [{ "_index" : "pouetpouet", "_type" : "mediaasset", "_id" : "9001d270-c192-11e4-9ddf-003048be8676", "_score" : 3.451458, "_source" : { "id" : "9001d270-c192-11e4-9ddf-003048be8676", "creationDate" : "2015-03-03T10:46:36Z", "parentMediaAssetId" : "9001d270-c192-11e4-9ddf-003048be8676", "mediaResourcesIds" : ["73a853ff-e992-46ba-be11-c24f13d18ab4"], "name" : "yo coucou", "keywords" : [{ "id" : "dd7dec78-aaf6-472e-98a5-475a6a6b22aa", "type" : "Keyword", "value" : "testabb2" }], "updatedDate" : "2016-05-10T10:54:38.917" }, "highlight" : { "keywords.value" : ["<em>testabb2</em>"] } } ] } }`

Does anybody has encounter a similar behavior ? Do we did something wrong ?

What we would like is that the first query (not working query) returns us the highlight information.

Thanks in advance,

Sincerely,

A. Babilone

---

<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 5, 2017, 10:52pm UTC](https://discuss.elastic.co/t/inconsistency-in-search-highlight-results/49769/2 "2017-07-05T22:52:29Z")

</div>


