elasticsearch - Is an nGram fuzzy search possible? -


i'm trying ngram filter work fuzzy search, won't. specifically, i'm trying "rugh" match on "rough".

i don't know whether it's not possible, or possible i've defined mapping wrong, or mapping fine search isn't defined correctly.

mapping:

{     settings = new         {             index = new             {                 number_of_shards = 1,                 number_of_replicas = 1,                  analysis = new                 {                     filter = new                     {                         edge_ngram_filter = new                         {                             type = "ngram",                             min_gram = 3,                             max_gram = 8                         }                     }, // filter                      analyzer = new                     {                         analyzer_ngram = new                         {                             type = "custom",                             tokenizer = "standard",                             filter = new string[]                             {                                 "lowercase",                                 "edge_ngram_filter"                             }                         }                     }  // analyzer                  } // analysis              } // index         },  //  settings      mappings = new     {         j_cv = new         {             properties = new             {                 text = new                 {                     type = "text",                     include_in_all = false,                     analyzer = "analyzer_ngram",                     search_analyzer = "standard"                 }             }         }   //  j_cv     }   //  mappings } 

document:

{    id = guid.newguid(),    name = "jimmy riddle",    keyword = new list<string>(new string[] { "hunting", "high", "hotel", "california" }),    text = "rough justice program on bbc years ago. quite interesting. match?" } 

search:

{     query = new     {         query_string = new         {             fields = new string[] { "text" },             fuzziness = "3",             query = "rugh"         }     } } 

incidentally, "ugh" match you'd expect.

thanks can give,

adam.

the same analyzer should applied @ index , search time, search_analyzer=standard wrong, should working if remove it. https://www.elastic.co/guide/en/elasticsearch/reference/current/search-analyzer.html

edit: forgot fuzzy operator "~" in query, if add "rugh" work!


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -