Skip to content

Instantly share code, notes, and snippets.

@imotov

imotov/boost.sh Secret

Created November 4, 2012 00:18
Show Gist options
  • Save imotov/7ecedea4f6a5219efb89 to your computer and use it in GitHub Desktop.
Save imotov/7ecedea4f6a5219efb89 to your computer and use it in GitHub Desktop.
Broken numeric boost
#!/bin/sh
curl -XDELETE localhost:9200/relevance
echo
curl -XPUT localhost:9200/relevance -d '{
"settings" : {
"index" : {
"number_of_shards" : 1,
"number_of_replicas" : 0
}
},
"mappings" : {
"doc" : {
"properties" : {
"important_int": {
"type" : "integer",
"store": "yes",
"boost": 1.2
},
"unimportant_int": {
"type" : "integer",
"store": "yes"
}
}
}
}
}'
echo
curl -XPUT localhost:9200/relevance/doc/1 -d '{"important_int":5, "unimportant_int": 10}'
echo
curl -XPUT localhost:9200/relevance/doc/2 -d '{"important_int":10, "unimportant_int": 5}'
echo
curl -XPUT localhost:9200/relevance/doc/3 -d '{ "important_int":{"value":10,"_boost":10}, "unimportant_int": 5}'
echo
curl -XPOST localhost:9200/relevance/_refresh
echo
curl "localhost:9200/relevance/_search?q=important_int:5+unimportant_int:5&pretty=true&explain=false"
echo
curl "localhost:9200/relevance/_search?q=important_int:10+unimportant_int:10&pretty=true&explain=false"
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment