Skip to content

Instantly share code, notes, and snippets.

@dylanahsmith
Created August 19, 2012 06:08
Show Gist options
  • Save dylanahsmith/3392534 to your computer and use it in GitHub Desktop.
Save dylanahsmith/3392534 to your computer and use it in GitHub Desktop.
elasticsearch ignores boost on prefix search
#!/bin/sh
curl -XDELETE 'http://localhost:9200/foo'
curl -XPUT 'http://localhost:9200/foo/?pretty=true' -d '
{
"mappings" : {
"bar" : {
"properties" : {
"title" : {
"boost" : 2,
"type" : "string"
},
"body" : {
"type" : "string"
}
}
}
}
}
'
curl -XPOST 'http://localhost:9200/foo/bar?pretty=true' -d '{
"title" : "Configure",
"body" : "Stuff about how to setup something"
}'
curl -XPOST 'http://localhost:9200/foo/bar?pretty=true' -d '{
"title" : "Setup",
"body" : "Stuff about how to configure something"
}'
curl -XPOST 'http://localhost:9200/_refresh'
curl -XGET 'http://localhost:9200/foo/bar/_search?pretty=true' -d '{
"query" : {
"field" : {
"_all" : "configure"
}
}
}'
curl -XGET 'http://localhost:9200/foo/bar/_search?pretty=true' -d '{
"query" : {
"field" : {
"_all": {
"query": "configure*",
"rewrite": "top_terms_10"
}
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment