Created
December 5, 2013 02:20
-
-
Save jakejscott/7799153 to your computer and use it in GitHub Desktop.
Elastic search completion suggestor (run this in sense)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PUT music | |
PUT music/song/_mapping | |
{ | |
"song": { | |
"properties": { | |
"name": { | |
"type": "string" | |
}, | |
"suggest": { | |
"type": "completion", | |
"index_analyzer": "simple", | |
"search_analyzer": "simple", | |
"payloads": true | |
} | |
} | |
} | |
} | |
PUT music/song/1?refresh=true | |
{ | |
"name": "Nevermind", | |
"suggest": { | |
"input": [ | |
"Nevermind", | |
"Nirvana" | |
], | |
"output": "Nirvana - Nevermind", | |
"payload": { | |
"artistId": 2321 | |
}, | |
"weight": 34 | |
} | |
} | |
POST music/_search | |
{ | |
"suggest" : "Nirvana" | |
} | |
POST music/_suggest?pretty | |
{ | |
"song-suggest" : { | |
"text" : "never", | |
"completion" : { | |
"field" : "suggest" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment