# ES 2.2 JavaScript, Highlight not working

**URL:** <https://discuss.elastic.co/t/es-2-2-javascript-highlight-not-working/41389>\
**Category:** Elasticsearch\
**Created:** [February 10, 2016, 3:03pm UTC](https://discuss.elastic.co/t/es-2-2-javascript-highlight-not-working/41389 "2016-02-10T15:03:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raffaele\_Garofalo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raffaele_garofalo/32/993_2.png) [@Raffaele\_Garofalo](https://discuss.elastic.co/u/Raffaele_Garofalo)\
**Post date:** [February 10, 2016, 3:03pm UTC](https://discuss.elastic.co/t/es-2-2-javascript-highlight-not-working/41389/1 "2016-02-10T15:03:37Z")

</div>

Hi guys, recently we upgraded to ElasticSearch 2.2 and we startred to use the Elasticsearch.js library for Angular.  
Right now I can execute all my old queries but the Highlight is not returned anymore.

This is how I call a query where the term "pippo" has to be searched across all indexes and all fields:

```
$esClient
    .search({
        index: 'myIndex',
        "size": $scope.header.recordsPerPage,
        "from": $scope.header.currentPage * $scope.header.recordsPerPage,
        body: {
            "query": {
                "filtered": {
                    "query": {
                        "match": {
                            "_all": $scope.options.criteria
                        }
                    }
                }
            },
            "highlight": {
                "fields": {
                    "*": {}
                }
            }
        }
    })

```

The resultset does not contains the highlight anymore and no errors are returned. Am I doing something wrong here?

---

<div class="post-metadata">

**Author:** ![Raffaele\_Garofalo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raffaele_garofalo/32/993_2.png) [@Raffaele\_Garofalo](https://discuss.elastic.co/u/Raffaele_Garofalo)\
**Post date:** [February 11, 2016, 9:05am UTC](https://discuss.elastic.co/t/es-2-2-javascript-highlight-not-working/41389/2 "2016-02-11T09:05:29Z")

</div>

In my opinion this is a bug in the JavaScript library.  
The payload sent is this one:

`{"query":{"match":{"_all":"pippo"}},"highlight":{"fields":{"*":{}}}}`

This is the POST query string:

`http://localhost:9200/mproof/_search?from=0&size=10&order=_score`

And I am using SHIELD and passing the Administrator account.

---

<div class="post-metadata">

**Author:** ![Raffaele\_Garofalo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/raffaele_garofalo/32/993_2.png) [@Raffaele\_Garofalo](https://discuss.elastic.co/u/Raffaele_Garofalo)\
**Post date:** [February 15, 2016, 8:12am UTC](https://discuss.elastic.co/t/es-2-2-javascript-highlight-not-working/41389/3 "2016-02-15T08:12:36Z")

</div>

I found the solution, since ES 2.0 the highlight mechanism has drastically changed especially if you query all fields. The solution is to use the following option **require\_field\_match: false** :

```
highlight: {
                    require_field_match: false,
                    fields: {
                        "*":{}
                    }
                }
```

---

<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, 11:16pm UTC](https://discuss.elastic.co/t/es-2-2-javascript-highlight-not-working/41389/4 "2017-07-05T23:16:27Z")

</div>


