c#
NOT LIKE query in NEST
I've written a NEST query that matches documents that have words in a string ("queryString" below). I want to filter out documents that contain the word "not". I've tried the boolean query but it doesn't filter out the documents. What am I doing wrong here? var searchResponse2 = _EsClientDAL.Current.Search<DTO.riSmall>(s => s .Size(50) .Query(q => q .Bool(b => b .Must(mu => mu .Match(m => m .Field(f => f.SceneText) .Query(queryString) ) , mu => !mu .Term(p => p.SceneText, "not") ) ) ) .Highlight(h => h .PreTags("|") .PostTags("|") .Fields( fs => fs .Field(p => p.SceneText) .Type("plain") .ForceSource() .FragmentSize(150) .NumberOfFragments(3) .NoMatchSize(150) ) ) );
you can try with following query using must_not Query(q => q .Bool(b => b .Must(mu => mu .Match(m => m .Field(f => f.SceneText) .Query(queryString) ) ) .MustNot(mn=> mn .Term(p => p.SceneText, "not") ) ) ) Hope this helps you
Related Links
Adding IValueConverter breaks updates when changed occur from observable collection to UI
To Use or Not To Use the 'this' qualifier in C# [duplicate]
How to deserialize json into a c# class containing interface/abstract class properties
Javascript: decoding a string
Lock on Dictionary's TryGetValue() - Performance issues
Convert SQL to Linq - how to?
C#/Winforms, DataGridView/Combobox
Get rid of <ArrayOfClassname> root element when serializing array
How to install Microsoft Spec# 2010
How to print after join linq query
Changing the View for a ViewModel
how to attach a c# object to an excel worksheet and have it saved when the workbook is saved
Simplest way to filter generic list
Why does Response.Redirect() work in Chrome but not in IE?
C# storing data from input to arraylist inside Class
GeckoEngine and C# load dll drivers problem