Last active
January 19, 2017 14:22
-
-
Save rehia/ec4b97b025ddf495f2d898a260bf5e97 to your computer and use it in GitHub Desktop.
Elasticsearch configuration for autocompletion search
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: { | |
number_of_shards: 1, | |
analysis: { | |
filter: { | |
autocomplete_filter: { | |
type: 'ngram', | |
min_gram: 3, | |
max_gram: 15 | |
} | |
}, | |
analyzer: { | |
autocomplete: { | |
type: 'custom', | |
tokenizer: 'standard', | |
filter: [ | |
'lowercase', | |
'autocomplete_filter' | |
] | |
} | |
} | |
} | |
}, | |
mappings: { | |
[type]: { | |
properties: { | |
name: { | |
type: 'string', | |
fields: { | |
autocomplete: { | |
type: 'string', | |
analyzer: 'autocomplete', | |
search_analyzer: 'standard' | |
} | |
} | |
}, | |
twitter_keywords: { | |
type: 'string', | |
fields: { | |
autocomplete: { | |
type: 'string', | |
analyzer: 'autocomplete', | |
search_analyzer: 'standard' | |
} | |
} | |
}, | |
instagram_keywords: { | |
type: 'string', | |
fields: { | |
autocomplete: { | |
type: 'string', | |
analyzer: 'autocomplete', | |
search_analyzer: 'standard' | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
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
{ | |
query: { | |
multi_match: { | |
query, | |
type: 'most_fields', | |
fields: [ '*_keywords^4', 'name^8', '*_keywords.autocomplete', 'name.autocomplete^2' ] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment