Should highlighting work with all query types?

Highlighting does not seem to work with custom_score or boosting (and maybe
others, but these were the one I just tested).

Example (from https://gist.github.com/9f003179c02ebe9b69ae):

curl -XDELETE http://localhost:9200/test?pretty
curl -XPOST http://localhost:9200/test/my_type/1?pretty -d '
{
"foo": {
"bar": "this is bar"
}
}'

give es some time:

sleep 1

works as expected:

curl http://localhost:9200/test/_search?pretty -XPOST -d '{
"query": {"query_string": {"query":"bar"}},
"highlight": {"fields": {"foo.bar":{}}}
}'

does not highlight:

curl http://localhost:9200/test/_search?pretty -XPOST -d '{
"query": {
"boosting": {
"positive": {
"query_string": {
"query":"bar"
}
},
"negative": {"term": {"foo.bar": "baz"}},
"negative_boost": 0.9
}
},
"highlight": {"fields": {"foo.bar":{}}}
}'

does not highlight either:

curl http://localhost:9200/test/_search?pretty -XPOST -d '{
"query": {
"custom_score": {
"query": {
"query_string": {
"query":"bar"
}
},
"script": "_score"
}
},
"highlight": {"fields": {"foo.bar":{}}}
}'

Hi,

I created ticked for this

There is already a quick pull request, you can give it a try

Thanks,
Lukas

On Thu, Sep 8, 2011 at 11:33 AM, Njal Karevoll nkvoll@gmail.com wrote:

Highlighting does not seem to work with custom_score or boosting (and maybe
others, but these were the one I just tested).

Example (from gist:9f003179c02ebe9b69ae · GitHub):

curl -XDELETE http://localhost:9200/test?pretty

curl -XPOST http://localhost:9200/test/my_type/1?pretty -d '

{
"foo": {

    "bar": "this is bar"

}

}'

give es some time:

sleep 1

works as expected:

curl http://localhost:9200/test/_search?pretty -XPOST -d '{
"query": {"query_string": {"query":"bar"}},
"highlight": {"fields": {"foo.bar":{}}}
}'

does not highlight:

curl http://localhost:9200/test/_search?pretty -XPOST -d '{
"query": {

    "boosting": {
        "positive": {
            "query_string": {

                "query":"bar"

            }
        },

        "negative": {"term": {"foo.bar": "baz"}},

        "negative_boost": 0.9
    }
},

"highlight": {"fields": {"foo.bar":{}}}

}'

does not highlight either:

curl http://localhost:9200/test/_search?pretty -XPOST -d '{

"query": {
    "custom_score": {
        "query": {

            "query_string": {
                "query":"bar"
            }

        },
        "script": "_score"
    }

},
"highlight": {"fields": {"foo.bar":{}}}

}'