Skip to content

Instantly share code, notes, and snippets.

@nkvoll
Created September 8, 2011 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nkvoll/9f003179c02ebe9b69ae to your computer and use it in GitHub Desktop.
Save nkvoll/9f003179c02ebe9b69ae to your computer and use it in GitHub Desktop.
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":{}}}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment