ES 2.2 JavaScript, Highlight not working

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?

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.

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: {
                        "*":{}
                    }
                }
1 Like