Skip to content

Instantly share code, notes, and snippets.

@davedash
Created March 11, 2015 22:00
Show Gist options
  • Save davedash/5051b555af8880b26697 to your computer and use it in GitHub Desktop.
Save davedash/5051b555af8880b26697 to your computer and use it in GitHub Desktop.
{
"index": {
"analysis": {
"filter": {
"autocomplete_filter": {
"type": "edge_ngram",
"min_gram": "1",
"max_gram": "20"
},
"word_joiner": {
"type": "word_delimiter",
"catenate_all": true
}
},
"analyzer": {
"autocomplete": {
"type": "custom",
"filter": [
"lowercase",
"word_joiner",
"autocomplete_filter"
],
"tokenizer": "keyword"
},
"keyword_lowercase": {
"filter": "lowercase",
"type": "custom",
"tokenizer": "keyword"
},
"default": {
"type": "snowball"
}
}
}
}
}
@davedash
Copy link
Author

Produces the following:

» curl -s -XGET 'localhost:9200/test/_analyze?analyzer=autocomplete&pretty=1' -d 'Pizza Hut' | jq ".tokens[]|.token" -r
p
pi
piz
pizz
pizza
p
pi
piz
pizz
pizza
pizzah
pizzahu
pizzahut
h
hu
hut

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment