Reputation:
I am using NEST(c#) client to play with elasticsearch in which when i search question like "how to find a " it will provide the result which contain max-hits for words like to and a . how can avoid search words like a , to, is , are, was etc. this is my code sample
var Result = client.Search(q => q
.Index(IndexName)
.From(0)
.Type("table")
.Size(10)
.Fields("title","description")
.QueryString(searchWord))
Upvotes: 0
Views: 346
Reputation:
In NEST version 1.0 they implemented this.
You can do it by adding this line to your search I guess.
.Query(b => b.CommonTerms(c => c.CutOffFrequency(0.1)))
I have not been able to test this but I hope it helps.
More info can be found here: (elasticsearch 1.0)
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-common-terms-query.html#query-dsl-common-terms-query
and here: (release nodes NEST 1.0)
http://www.elasticsearch.org/blog/introducing-elasticsearch-net-nest-1-0-0-beta1/
Upvotes: 1