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

Parallel.Foreach - NULL Tasks
Force a Subclass to Define Extra Fields in C#
Await doesn't work with BeginInvoke?
.NET system-wide EventWaitHandle name allowed characters
c# sqlite command formatting
System.InvalidOperationException when getting a List with an ApiController
Calling a method from one class in another.
Black objects on screen in Unity3D
WP 8 - How to Open Menu with Application Bar Icon Button
Text box getting cleared beacause of update panel
Serialize a class that uses reflection to fill its properties
data type issue with dbnull c#
How to upload multiple files to server with form post MVC?
Retrieve and update record with Entity Framework in web app
Casting as a form from a window handle
C# DeflateStream Decompress with C++

Categories

HOME
twitter-bootstrap
stata
ide
sip
casting
pandoc
swap
rtc
rename
angular-universal
ndepend
ldap-query
jetbrains
mongodb-replica-set
drush
jinja2
aiml
aws-devicefarm
caldav
computation-theory
android-wifi
minimagick
javaagents
fastboot
ng-tags-input
ppp
suitescript
sphinx4
ocl
tikz
wercker
ports
microstrategy
zimbra
http-proxy
wunderground
dotnetnuke-module
const
pygraphviz
mybatis-generator
tapply
compiler-warnings
flume-ng
pexpect
head
gradlew
chrome-custom-tabs
line-endings
xmldom
opos
vertex
nservicebus6
acceleo
cardview
distcc
alfred
sprockets
paypal-subscriptions
bluetooth-lowenergy-4.2
encode
android-facebook
random-sample
php-gd
adempiere
identifying
pushwoosh
sicstus-prolog
numerical-recipes
alpha-beta-pruning
jsonmodel
tigase
scjp
episerver-7
satisfiability
git-subtree
kernel-density
flask-mongoengine
vbaccelerator
facebook-likebox
mysql-error-1146
grape-api
static-class
wpa
panelgrid
phone-state-listener
metapost
report-viewer2010
openafs
jquery-1.8
jquery-ui-map
code-organization
zend-validate
mcpd
wdm
execjs
jquery-click-event
mismatch
qvariant
response-time
cpack
onunload
chars
pitch-shifting
numerical-computing
script-tag
opengl-to-opengles

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile