Friday 15 July 2011

c# - Elasticsearch NEST -



c# - Elasticsearch NEST -

currently started using elasticsearch wrapper c# "nest", , i'm facing troubles writing queries check partial similarities such in "book" , "books", when have document contains "books", if search "book" doesn't find it: here code :

var articles = client.search<productresult>(s => s .from(0) .size(1000) .matchall() .query(q => q.querystring(d => d .query(query) )));

try analyzing fields stemming analyzer snowball seek it's best cut down words root form. example, books , booking => book, jumps , jumping => jump. etc... algorithm behind isn't perfect , trip on irregular words/plural forms, part works (on european languages).

you can apply different analyzers when create index, or on existing index using update mapping api. either way, you'll have reindex our documents apply new analysis.

create index illustration using nest:

client.createindex("yourindex", c => c ... .addmapping<yourtype>(m => m .mapfromattributes() .properties(ps => ps .string(s => s.name("fieldname").analyzer("snowball")) ... ) ) );

update mapping example:

client.map<yourtype>(m => m .mapfromattributes() .index("yourindex") .properties(ps => ps .string(s => s.name("fieldname").analyzer("snowball")) ... ) );

here's great info on algorithmic stemmers in definitive guide.

c# elasticsearch nest

No comments:

Post a Comment