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
opened 09:25PM - 08 Sep 11 UTC
closed 09:31AM - 11 Mar 13 UTC
>bug
reported by: https://github.com/nkvoll
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=1&refresh=true' -d '
{
"foo": {
"bar": "this is bar"
}
}'
# 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":{}}}
}'
```
There is already a quick pull request, you can give it a try
elastic:master
← lukas-vlcek:highlighting
opened 09:38PM - 08 Sep 11 UTC
A bit messy but should be working fine. Needs to be reviewed.
Idea: Going forwa… rd it might be useful to add some interface that would be used by highlighting code. The interface would force ES specific Query implementations to return Query that can be understood by highlighting framework. For example it would be subQuery for some queries or the query that is returned by rewrite method. Then the messy logic based on `instanceof` could have been reduced.
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":{}}}
}'