Skip to content

Instantly share code, notes, and snippets.

@imotov
Created September 11, 2013 17:41
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 imotov/b11f866c48b090158d7e to your computer and use it in GitHub Desktop.
Save imotov/b11f866c48b090158d7e to your computer and use it in GitHub Desktop.
curl -X DELETE localhost:9200/music
curl -X PUT localhost:9200/music -d '{
"settings": {
"number_of_shards": 1
}
}'
curl -X PUT localhost:9200/music/song/_mapping -d '{
"song" : {
"properties" : {
"name" : { "type" : "string" },
"suggest" : {
"type" : "multi_field",
"path": "just_name",
"fields": {
"suggest": {
"type": "string",
"index": "analyzed"
},
"complete": {
"type": "completion"
}
}
}
}
}
}'
curl -X PUT 'localhost:9200/music/song/1?refresh=true' -d '{
"name" : "Nevermind",
"suggest" : "Nirvana"
}'
curl -X POST 'localhost:9200/music/_refresh'
curl -X POST 'localhost:9200/music/_suggest?pretty' -d '{
"song-suggest" : {
"text" : "n",
"completion" : {
"field" : "complete"
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment