Skip to content

Instantly share code, notes, and snippets.

@cedufca
Created October 3, 2011 14:45
Show Gist options
  • Save cedufca/1259248 to your computer and use it in GitHub Desktop.
Save cedufca/1259248 to your computer and use it in GitHub Desktop.
ElasticSearch ngrams
# My settings
mappings:
event:
index_analyzer: standardAnalyzer
search_analyzer: standardAnalyzer
properties:
name:
type: multi_field
fields:
name: { type: string, index: analyzed }
partial: { type: string, index: analyzed, analyzer: ngramAnalyzer }
description:
type: multi_field
fields:
description: { type: string, index: analyzed }
partial: { type: string, index: analyzed, analyzer: ngramAnalyzer }
address:
type: multi_field
fields:
address: { type: string, index: analyzed }
partial: { type: string, index: analyzed, analyzer: ngramAnalyzer }
programs:
type: multi_field
fields:
programs: { type: string, index: analyzed }
partial: { type: string, index: analyzed, analyzer: ngramAnalyzer }
settings:
analysis:
filter:
defaultNGram:
type: edgeNGram
side: front
min_gram: 1
max_gram: 10
analyzer:
ngramAnalyzer:
type: custom
tokenizer: standard
filter: [standard, lowercase, asciifolding, defaultNGram]
standardAnalyzer:
type: custom
tokenizer: standard
filter: [standard, lowercase, asciifolding]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment