search - Searching by name on ElasticSearch -
say have index thousands of names of clients , need able search them in administration panel, this:
john anders john smith sarah smith bjarne stroustrup
i want have full search capabilities on it, means that:
if search
john
, shouldjohn anders
,john smith
.if search
smith
, should smith's couple.if search
sarasmit
orsara smit
, shouldsarah smith
searched initials of name , whitespace doesn't matter.if search
johers
orjoh ers
, shouldjohn anders
searched strings contained in name.
i figured out use analyser lowercase filter , keyword tokenizer don't work every case.
what right combination of tokenizers/analysers/queries use?
have @ this, question asked regarding similar data set. here @ index settings/mapping have used produce decent results. development has ceased on interim i've produced far. can develop queries -
{ "settings": { "number_of_shards": 5, "number_of_replicas": 0, "analysis": { "filter": { "synonym": { "type": "synonym", "synonyms_path": "synonyms/synonyms.txt" }, "my_metaphone": { "type": "phonetic", "encoder": "metaphone", "replace": false } }, "analyzer": { "synonym": { "tokenizer": "whitespace", "filter": [ "lowercase", "synonym" ] }, "metaphone": { "tokenizer": "standard", "filter": [ "my_metaphone" ] }, "porter": { "tokenizer": "standard", "filter": [ "lowercase", "porter_stem" ] } } } }, "mappings": { "mes": { "_all": { "enabled": false }, "properties": { "pty_forename": { "type": "multi_field", "store": "yes", "fields": { "pty_forename": { "type": "string", "analyzer": "simple" }, "metaphone": { "type": "string", "analyzer": "metaphone" }, "porter": { "type": "string", "analyzer": "porter" }, "synonym": { "type": "string", "analyzer": "synonym" } } }, "pty_full_name": { "type": "string", "index": "not_analyzed", "store": "yes" }, "pty_surname": { "type": "multi_field", "store": "yes", "fields": { "pty_surname": { "type": "string", "analyzer": "simple" }, "metaphone": { "type": "string", "analyzer": "metaphone" }, "porter": { "type": "string", "analyzer": "porter" }, "synonym": { "type": "string", "analyzer": "synonym" } } } } } } }'
note have used phonetic plugin , have comprehensive list of synonyms critical returning results richard
when dick
entered.
Comments
Post a Comment