Skip to content

Instantly share code, notes, and snippets.

@marucjmar
Last active January 20, 2018 19:05
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 marucjmar/34a9fdd3fe150ebc088ec4b6fb224422 to your computer and use it in GitHub Desktop.
Save marucjmar/34a9fdd3fe150ebc088ec4b6fb224422 to your computer and use it in GitHub Desktop.
{
"settings":{
"analysis":{
"filter":{
"nGram_filter":{
"type":"nGram",
"min_gram":1,
"max_gram":20,
"token_chars":[
"letter",
"digit",
"punctuation",
"symbol"
]
}
},
"analyzer":{
"nGram_analyzer":{
"type":"custom",
"tokenizer":"whitespace",
"filter":[
"lowercase",
"nGram_filter"
]
},
"whitespace_analyzer":{
"type":"custom",
"tokenizer":"whitespace",
"filter":[
"lowercase"
]
}
}
}
},
"mappings":{
"area":{
"_all":{
"analyzer":"nGram_analyzer",
"search_analyzer":"whitespace_analyzer"
},
"properties":{
"full_name":{
"analyzer":"nGram_analyzer",
"search_analyzer":"whitespace_analyzer",
"type":"text"
}
}
}
}
}
{"query": %{
"bool": {
"should": [
{"match": {"full_name": params[:filter][:q]}},
],
"filter": [
{ "term": { "level": "place" }},
]
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment