Elasticsearch - Nest - Missing First Character -


i using nest client against elasticsearch. using n-gram index analyzer. noticing odd behavior - when search words beginning not getting results. however, if search second character on, works perfectly. these normal english letters.

so, instance, find words containing 'kitty' if search 'itty', 'itt', 'tty', etc. not 'ki', 'kit', etc. it's n-gram skipping on first character.

i not sure if being caused nest or if normal behavior n-gram. index settings similar found in post: elasticsearch using nest: how configure analyzers find partial words? except max-gram 10.

update

i simplified code little bit , verified same behavior.

here mapping configuration defined using nest:

const string index = "myapp"; const string type = "account"; const string indexanalyzer = "custom_ngram_analyser"; const string searchanalyzer = "standard"; const string tokenizer = "custom_ngram_tokenizer"; const string tokenfilter = "custom_ngram_tokenfilter"; ... client.createindex(index, =>         .analysis(ad => ad             .analyzers(a => a.add(indexanalyzer, new customanalyzer() { tokenizer = tokenizer }))             .tokenizers(t => t.add(tokenizer, new ngramtokenizer() { mingram = 1, maxgram = 15 }))             .tokenfilters(f => f.add(tokenfilter, new ngramtokenfilter() { mingram = 1, maxgram = 15 })))         .typename(account);         .idfield(r => r.setpath("accountid").setindex("not_analyzed").setstored(true));         .properties(ps => ps.number(p => p.name(r => r.accountid)                                           .index(nonstringindexoption.not_analyzed)                                           .store(true));                             .string(p => p.name(r => r.accountname)                                           .index(fieldindexoption.analyzed)                                           .indexanalyzer(indexanalyzer)                                           .searchanalyzer(searchanalyzer)                                           .store(true)                                           .termvector(termvectoroption.no)))); 

and search first character missing:

searchcriteria criteria = new searchcriteria() { accountname = "kitty" };  client.search<searchaccountresult>(s => s     .index(index)     .type(type)     .query(q => q.bool(b => b.must(d => d.match(m => m.onfield(r => r.accountname).querystring(criteria.accountname)))))     .sortdescending("_score")) 

i running issue because index case sensitive. of test data started upper case letters.

i changed case-insensitive, update did not take place immediately. though analyzer appeared configured case-insensitive, index not refreshed.

wiping out index , repopulating scratch fixed issue.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -