elasticsearch - Nest update index settings -


i following post creating index nest , trying update index settings. runs fine html_strip filter not stripping html. code is

var node = new uri(_url + ":" + _port); var settings = new connectionsettings(node); settings.setdefaultindex(index); _client = new elasticclient(settings);  //to apply filters during indexing use folding remove diacritics , html strip remove html _client.updatesettings(         f = > f.analysis(descriptor = > descriptor                 .analyzers(                         bases = > bases                         .add("folded_word", new customanalyzer                         {                         filter = new list < string > { "icu_folding", "trim" },                                 tokenizer = "standard"                         }                         )                         )                 .charfilters(                         cf = > cf.add("html_strip", new htmlstripcharfilter())                         )                 )         );       

you getting error:

can't update non dynamic settings[[index.analysis.analyzer.folded_word.filter.0, index.analysis.char_filter.html_strip.type, index.analysis.analyzer.folded_word.filter.1, index.analysis.analyzer.folded_word.type, index.analysis.analyzer.folded_word.tokenizer]] open indices[[my_index]]

before try update settings, close index first, update settings , reopen afterwards. have look.

client.closeindex(..);  client.updatesettings(..);  client.openindex(..); 

update

add html_strip char filter custom analyzer:

.analysis(descriptor => descriptor                     .analyzers(bases => bases.add("folded_word",                         new customanalyzer                         {                             filter = new list<string> { "icu_folding", "trim" },                              tokenizer = "standard",                              charfilter = new list<string> { "html_strip" }                         }))                 ) 

now can run test check if analyzer returns correct tokens:

client.analyze(a => a.index(indexname).text("this <a> test <div>").analyzer("folded_word")); 

output:

this test 

hope helps.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -