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:

  1. if search john, should john anders , john smith.

  2. if search smith, should smith's couple.

  3. if search sarasmit or sara smit, should sarah smith searched initials of name , whitespace doesn't matter.

  4. if search johers or joh ers, should john 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

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -