Skip to content

Instantly share code, notes, and snippets.

@uliSchi
Created July 30, 2012 14:45
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 uliSchi/3207478 to your computer and use it in GitHub Desktop.
Save uliSchi/3207478 to your computer and use it in GitHub Desktop.
elasticsearch boost problem
curl -XDELETE 'http://localhost:9200/myindex'
curl -XPOST 'http://localhost:9200/myindex'
curl -XPOST 'http://localhost:9200/_refresh'
curl -XPUT 'http://localhost:9200/myindex/author/_mapping' -d '{
"author": {
"_boost": {
"name": "boostFactor",
"null_value": 1.0
},
"properties": {
"id": {
"type": "long"
},
"boostFactor": {
"type": "float",
"null_value": 1.0
},
"name": {
"type": "string",
"index": "not_analyzed",
"boost": 20.0
},
"countryOfBirth": {
"type": "string"
}
}
}
}'
curl -XPUT 'http://localhost:9200/myindex/author/1' -d '{
"id": 1,
"boostFactor": 0.22,
"name": "Sewald Kruse",
"countryOfBirth": "Deutschland"
}'
curl -XPUT 'http://localhost:9200/myindex/author/2' -d '{
"id": 2,
"boostFactor": 0.61,
"name": "Sergio Herold",
"countryOfBirth": "Peru"
}'
curl -XPUT 'http://localhost:9200/myindex/author/3' -d '{
"id": 3,
"boostFactor": 0.03,
"name": "Sebastion Wund",
"countryOfBirth": "Deutschland"
}'
curl -XPUT 'http://localhost:9200/myindex/author/4' -d '{
"id": 4,
"boostFactor": 0.07,
"name": "Gudrun Weil",
"countryOfBirth": "Serbien"
}'
curl -XPOST 'http://localhost:9200/_refresh'
curl -XGET 'http://localhost:9200/myindex/author/_search' -d '{
"query": {
"prefix": {
"name": "Se"
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment