Skip to content

Instantly share code, notes, and snippets.

Created August 2, 2012 10:12
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 anonymous/3236078 to your computer and use it in GitHub Desktop.
Save anonymous/3236078 to your computer and use it in GitHub Desktop.
ElasticSearch boost/not_analyzed 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": {
"properties": {
"id": {
"type": "long"
},
"boostFactor": {
"type": "float",
"null_value": 1.0
},
"name": {
"type": "string",
"index": "not_analyzed"
},
"countryOfBirth": {
"type": "string"
}
}
}
}'
curl -XPUT 'http://localhost:9200/myindex/author/1' -d '{
"id": 1,
"boostFactor": 0.22,
"name": "SewaldKruse",
"countryOfBirth": "Deutschland"
}'
curl -XPUT 'http://localhost:9200/myindex/author/2' -d '{
"id": 2,
"boostFactor": 0.61,
"name": "SergioHerold",
"countryOfBirth": "Peru"
}'
curl -XPUT 'http://localhost:9200/myindex/author/3' -d '{
"id": 3,
"boostFactor": 0.07,
"name": "GudrunWeil",
"countryOfBirth": "Serbien"
}'
curl -XPOST 'http://localhost:9200/_refresh'
echo
echo
echo QUERY_STRING
curl -XGET 'http://localhost:9200/myindex/author/_search?pretty=true' -d '{
"query": {
"query_string": {
"query": "name:(se*)^20 se*"
}
}
}'
echo
echo
echo MAPPING :
curl -XGET 'http://localhost:9200/myindex/author/_mapping?pretty=true'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment