elasticsearch


How to define two word in spacing


My elasticsearch coding as below:
"query": {
"constant_score" : {
"filter" : {
"bool": {
"must": [
{
"terms": {"stkno" : ["Net Asset","asset combine"]}},
{ "range": { "CDate": { "gte": "2015-01-01" , "lte": "2017-06-03T23:59:59" } } } ]
}}}}
this is mapping:
{
"news": {
"mappings": {
"bursa": {
"_timestamp": {},
"properties": {
"CDate": {
"type": "date",
"format": "epoch_millis||dateOptionalTime"
},
"RDate": {
"type": "date",
"format": "epoch_millis||dateOptionalTime"
},
"category": {
"type": "string"
},
"content": {
"type": "string"
},
"exDate": {
"type": "string"
},
"exgcode": {
"type": "string"
},
"htext": {
"type": "string"
},
"paymentDate": {
"type": "string"
},
"stat": {
"type": "string"
},
"stkno": {
"type": "string"
},
"tag": {
"type": "string"
}
}
}
}
}
}
Please kindly advice if my word is : Net Asset and Asset combine, use in Must condition,
if "Asset combine" not in the elasticsearch and "New Asset" in the elasticsearch, using Must condition so all indices can't search?
how to do i want find the word if ones of them inside elasticsearch?
Cause it can't find "Net Asset" exactly word when i use should condition.
Thanks
Since stkno is an analyzed field and you are applying terms query which looks for exact match, you are not able fetch results. Try this instead.
"bool": {
"should": [
{
"match": {
"stkno": "Net Asset",
"operator": "and"
}
},
{
"match": {
"stkno": "asset combine",
"operator": "and"
}
}
],
"must": [
{
"range": {
"CDate": {
"gte": "2015-01-01",
"lte": "2017-06-03T23:59:59"
}
}
}
]
}
Hope it helps!!

Related Links

ElasticSearch query not returning expected results
Fluentd High Availability Custom Index
How do I add an attribute to an Elasticsearch node for the purpose of Shard Allocation Filtering?
Configure ElasticSearch attachment mapper to use OCR plugin
ElasticSearch: How to search for a value in any field, across all types, in one or more indices?
Phrase suggestor - which index and query to act upon
Adding additional fields to ElasticSearch terms aggregation
ElasticSearch multi_match if field exists apply filter otherwise dont worry about it?
ElasticSearch Date Histogram Interval
Kibana 4 index patterns time-field
elasticsearch: Did I lose data when two of my three nodes went down?
ElasticSearch automatic typing
how to copy ElasticSearch field to another field
ElasticSearch Order after 2 term aggregation
Mapping openNLP or StanfordNLP in elasticsearch
An Elasticsearch filter to determine the absence of a value

Categories

HOME
webview
macos-sierra
class
list
xcode
apple-push-notifications
adfs3.0
concurrency
transactions
vsts-build
dronekit-python
drag-and-drop
ag-grid
mithril.js
firebase-database
joomla3.2
port
fireloop
mailmerge
feature-extraction
cuba-platform
spring-shell
pe
pst
maven-surefire-plugin
liferay-6.2
conda
uislider
candlestick-chart
ini
exchange-server-2010
plyr
webviewclient
uri
xdebug
running-object-table
tilemill
matlab-app-designer
john-the-ripper
gsp
mongoengine
adminer
nanogallery
extbase
tidal-scheduler
plane
get-event-store
httphandler
git-tfs
uiautomatorviewer
mongodb-aggregation
dtd
swiperefreshlayout
maatwebsite-excel
gapi
google-identity-toolkit
qpixmap
gnucash
noclassdeffounderror
codecharge
frame-grab
teensy
myfaces
servicestack-bsd
phpquery
ibm-was
cfwheels
android-studio-import
maven-shade-plugin
symja
ildasm
global-scope
tabris
otl
rpg
preorder
jack
cpu-time
assetic
meteorite
spring-security-acl
mousemotionlistener
jquery-transit
stty
virtual-channel
form-for
nsmutablestring
type-safety
wiktionary
photo-management
django-pagination
ccl
zend-test
eventaggregator
twitter-feed

Resources

Encrypt Message