Highlight not working with query_string

I am trying to highlight the results of a query as follows:

{
"size": 1,
"_source": "longDescription",
    "query" : {
        "query_string": {"query": "desert"}
    },
    "highlight" : {
        "fields" : {"longDescription" : {}}
    }
}

But it produces an empty list of highlights. Yet, if I write the query as follows, I do get highlights:

{
"size": 1,
"_source": "longDescription",
    "query" : {
        "match": { "longDescription": "desert" }
     },
    "highlight" : {
        "fields" : {"longDescription" : {}}
    }
}

What am I doing wrong?

Thx.

Alain Désilets

Which version is that?

Could you try:

"query_string": {"query": "longDescription:desert"}

It worked, thx!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.