Last active
March 20, 2016 18:06
-
-
Save senthilsivanath/97a9b4e4575d306887ea to your computer and use it in GitHub Desktop.
Elastic Search Analyser setup for auto complete search with fuziness
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
{ | |
"settings": { | |
"analysis": { | |
"filter": { | |
"autocomplete_filter": { | |
"type": "edge_ngram", | |
"min_gram": 1, | |
"max_gram": 15 | |
} | |
}, | |
"analyzer": { | |
"title_default_analyzer": { | |
"type": "custom", | |
"tokenizer":"standard", | |
"filter": ["lowercase", "asciifolding"] | |
}, | |
"title_snowball_analyzer": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": ["lowercase", "asciifolding", "snowball"] | |
}, | |
"title_shingle_analyzer": { | |
"type": "custom", | |
"tokenizer": "standard", | |
"filter": ["shingle", "lowercase", "asciifolding"] | |
}, | |
"autocomplete": { | |
"type": "custom", | |
"tokenizer":"standard", | |
"filter": [ | |
"lowercase", | |
"autocomplete_filter" | |
] | |
} | |
} | |
} | |
}, | |
"mappings": { | |
"Album": { | |
"properties": { | |
"AlbumName": {"type": "string", | |
"fields":{ | |
"raw": {"type": "string","analyzer": "title_default_analyzer"}, | |
"snowball" : {"type":"string","analyzer": "title_snowball_analyzer"}, | |
"shingle" : {"type":"string","analyzer": "title_shingle_analyzer"}, | |
"autocomplete":{"type": "string","analyzer": "autocomplete"} | |
} | |
} | |
} | |
}, | |
"Artist": { | |
"properties": { | |
"ArtistName": {"type": "string", | |
"fields":{ | |
"raw": {"type": "string","analyzer": "title_default_analyzer"}, | |
"snowball" : {"type":"string","analyzer": "title_snowball_analyzer"}, | |
"shingle" : {"type":"string","analyzer": "title_shingle_analyzer"}, | |
"autocomplete":{"type": "string","analyzer": "autocomplete"} | |
} | |
} | |
} | |
} | |
} | |
} | |
{ | |
"query": { | |
"multi_match" : { | |
"fields" : ["AlbumName.raw^10","AlbumName.shingle^2","AlbumName.snowball^2","AlbumName.autocomplete"], | |
"query" : "kadhal", | |
"fuzziness" : "AUTO" | |
} | |
} | |
} | |
{ | |
"query": { | |
"multi_match" : { | |
"fields" : ["ArtistName.raw^10","ArtistName.shingle^2","ArtistName.snowball^2","ArtistName.autocomplete"], | |
"query" : "vjiay", | |
"fuzziness" : "AUTO" | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment