Skip to content

Instantly share code, notes, and snippets.

@TehShrike
Created February 10, 2016 17:15
Show Gist options
  • Select an option

  • Save TehShrike/4dbc9fbad7243faae615 to your computer and use it in GitHub Desktop.

Select an option

Save TehShrike/4dbc9fbad7243faae615 to your computer and use it in GitHub Desktop.
Autocomplete indexes
{
"mappings": {
"company": {
"properties": {
"companyId": {
"type": "long"
},
"ngramName": {
"type": "string",
"index": "analyzed",
"analyzer": "company_name_analyzer"
},
"name": {
"type": "string",
"index": "analyzed",
"analyzer": "exact_match_analyzer"
},
"alphanumName": {
"type": "string",
"index": "analyzed",
"analyzer": "exact_match_alphanum_analyzer"
},
"unAnalyzedName": {
"type": "string",
"index": "not_analyzed"
},
"volume": {
"type": "long"
}
}
}
},
"settings": {
"analysis": {
"analyzer": {
"exact_match_alphanum_analyzer": {
"tokenizer": "keyword",
"char_filter": ["alphanum"],
"filter": ["lowercase", "asciifolding"]
},
"exact_match_analyzer": {
"tokenizer": "keyword",
"filter": ["lowercase", "asciifolding"]
},
"company_name_analyzer": {
"tokenizer": "ngram_2_10",
"char_filter": ["alphanum"],
"filter": ["lowercase", "asciifolding"]
}
},
"char_filter": {
"alphanum": {
"type": "pattern_replace",
"preserve_original": 1,
"pattern": "[^a-zA-Z0-9]",
"replacement": ""
}
},
"tokenizer": {
"ngram_2_10": {
"type": "nGram",
"min_gram": "2",
"max_gram": "10",
"token_chars": [ "letter", "digit", "punctuation", "symbol" ]
}
}
}
}
}
{
"mappings": {
"domain": {
"properties": {
"domainId": {
"type": "long"
},
"ngramName": {
"type": "string",
"index": "analyzed",
"analyzer": "domain_name_analyzer"
},
"name": {
"type": "string",
"index": "analyzed",
"analyzer": "exact_match_analyzer"
},
"unAnalyzedName": {
"type": "string",
"index": "not_analyzed"
},
"volume": {
"type": "long"
}
}
}
},
"settings": {
"analysis": {
"analyzer": {
"exact_match_analyzer": {
"tokenizer": "keyword",
"filter": ["lowercase"]
},
"domain_name_analyzer": {
"tokenizer": "ngram_2_10",
"filter": "lowercase"
}
},
"tokenizer": {
"ngram_2_10": {
"type": "nGram",
"min_gram": "2",
"max_gram": "10",
"token_chars": []
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment