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

Entity Framework Code First will not set Identity to Yes
Let class have unique id which doesn't ever change, no matter what
DataBinding issues after migration from .Net framework 3.5 to 4.6
COM Exception : 0x800AC472 raised when System is Locked (Excel VSTO)
SQLite-net Table<>() method call performance
How to set and limit page orientation in XAML or code?
Move .svc files to a folder
Unity Handheld.PlayFullScreenMovie double tap
Calling 2 methods asynchronously
C# MapReduce job with HortonWorks running in a virtual machine returning a 404 as response status code
Excel PowerQuery / C# WebAPI OData, Retrieving old Service Reference
BotBuilder: Customize Formflow
How to display row number in gridview
c# Many Parent forms one child
Gridview asp:Hyperlink not consistently working
How to make service run forever

Categories

HOME
azure-documentdb
dynamic
reference
salesforce-lightning
symfony-sonata
snmp
collision-detection
segmentation-fault
mongoimport
point-of-sale
virtualenv
oxid
jinja2
web-worker
jsfiddle
orange
android-wifi
polybase
include-path
google-drive-android-api
concatenation
v4l2
windows-mobile
smart-device
windows-10-mobile
azure-table-storage
restangular
dynamics-ax-2012-r3
recreate
2checkout
mplab
urhosharp
qt-designer
jcr
circle
rtos
n1ql
const
compiler-warnings
test-kitchen
wufoo
niagara-ax
azure-data-catalog
spring-webflow-2
line-endings
remap
jsfl
nao-robot
riemann
kendo-scheduler
trusted-computing
easy-thumbnails
computed-properties
optional-parameters
consolidation
virtualenvwrapper
vga
syslog4j
pebble-js
android-progressbar
trendline
nslocalizedstring
clear
app-data
android-facebook
jcomponent
windows-kernel
persian
windows-phone-8-emulator
uinavigationitem
cloud-storage
vspackage
valdr-bean-validation
screen-lock
illegalargumentexception
pytz
disparity-mapping
xts
disabled-control
isl
dateadd
hotlinking
cvi
.net-reflector
logo-lang
facebook-likebox
infomaker
exi
pageload
ftpwebrequest
string-length
configurationsection
motordriver
openafs
android-memory
project-files
code-organization
xhtmlrenderer
pitch-shifting
cons

Resources

Encrypt Message