Highlight not working with query_string


(Alain Désilets) #1

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


(David Pilato) #2

Which version is that?

Could you try:

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

(Alain Désilets) #3

It worked, thx!