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

Paerser Error when loading C# ASP.NET website hosted on GoDaddy [duplicate]
c# EF Model has foreign key to another model
Unit Test Async WebAPI 2 Get Request
Error while generating views with with Mysql and EF6
Identifying specific field that fails a conversion during a Database Query
EF Core “Invalid column name 'Discriminator'” error with inheritance
Gridview post back event
Got Unhandled Exception :: System.Xml.XmlException: Text node cannot appear in this state
“Syntax error in FROM clause” using OleDb in C# but no error for same query in Access itself
Custom Effect on model instance makes BasicEffect unrecognizeable on other (separately loaded) instance
Issue with Xamarin App Connecting to WCF Service over https
Reactive Extensions / UI cache web request data
ListView in UWP has unexpected behavior when INotifyCollectionChanged reports bulk changes
Singleton: create instance inside static constructor [duplicate]
2d array calculator in C# [closed]
Set TextBlock's ToolTip content

Categories

HOME
actionscript-3
cluster-analysis
snappy
dronekit
gap-system
highmaps
django-middleware
query-string
coordinates
sequence
jquery-select2
coding-style
minimax
dynamics-crm-2011
resharper
camunda
template10
versioning
project-structure
single-page-application
include-path
inline-assembly
pumping-lemma
sasl
mongoose-im
folder
andengine
language-detection
circle
eclipse-jdt
odp.net
dom4j
cocoa-scripting
ansible-inventory
ssdp
jvisualvm
definition
irr
peerjs
ocpjp
mef
togglebutton
opos
google-cloud-shell
multivalue
business-catalyst
optional-parameters
access-violation
settext
xcode7.1
geokit
init
syslog4j
usps
jmh
nugetgallery
bluetooth-lowenergy-4.2
app-data
magnet-uri
identifying
traminer
uinavigationitem
textblob
vensim
uiblureffect
apache-pivot
qf-test
xmlserializer
powershell-v1.0
windows-search
time-frequency
rails-migrations
django-tests
sigma-grid-control
azure-caching
cvi
acrofields
mdp
google-voice
friendly-id
infomaker
nokogiri
kohana-orm
servicemanager
ntdll
rbm
metapost
moonscript
waveout
jquery-ui-map
reflexil
jqzoom
funambol
object-tag
datarelation
nscharacterset
webdb
hp-trim
rpxnow
projectgen
qlibrary
managed-code

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App