elasticsearch


ElasticSearch query not returning expected results


The following query and index do not return the expected results. I don't understand, given the mapping constraint, when I search for "ICD9" it also returns results for "I9" and "9" among others. Any ideas?
Here is the index mapping:
{
"mappings": {
"mymap": {
"dynamic_templates": [
{
"codingstandard": {
"match": "*.CodingStandard",
"mapping": {
"type": "string",
"index": "not_analyzed"
}
}
}
]
}
}
}
Here is my query:
{
"fields": [
"Diagnosis.CodingStandard"
],
"query": {
"query_string": {
"query": "Diagnosis.CodingStandard:ICD9"
}
}
}
Here are some of my results:
"hits": {
"total": 9778,
"max_score": 3.501487,
"hits": [
{
"_index": "myindex",
"_type": "mymapping",
"_id": "264235",
"_score": 3.501487,
"fields": {
"Diagnosis.CodingStandard": [
"I9"
]
}
},
{
"_index": "myindex",
"_type": "mymapping",
"_id": "264261",
"_score": 3.501487,
"fields": {
"Diagnosis.CodingStandard": [
"9"
]
}
},
etc...
Yes because you are using query_string, elasticsearch doing fuzzy search by default for query_string.
if you want to do exact search you can do filter instead of query_string
{
"query":{
"filtered":{
"filter":{
"term":{
"Diagnosis.CodingStandard": "ICD9"
}
}
}
}
}

Related Links

Put filtered mustache search template on AWS elasticsearch cluster using javascript API
Get Percentage of Values in Elasticsearch
elasticsearch - aggregating counts on array matches
ElasticSearch has_child query does not support query_string
elastic search autocomplete, searching with space creating an issue
(ELK) logstash grok for SBR accounting log
aws cloudsearch/lucene query street names
Getting cardinality of multiple fields?
Aggregating a Key/Value list in ElasticSearch
“reverse cardinality” in elasticsearch?
ElasticSearch- Using Fields doesn't return any documents on Nest
Analyzer to find , e.g: “starbucks” when mistakenly querying “star bucks”
Elasticsearch - boost document based on field's specific value
How to get elasticsearch most used words?
Umlaut in Elastic Suggesters
Index creation move elastic search cluster to red

Categories

HOME
rust
android-espresso
android-studio
class
facebook-messenger
angular-ui-grid
devexpress
braintree
mathematical-optimization
apache-kafka-connect
openfoam
joomla3.2
sympy
reportviewer
twitter-oauth
scrape
graphdb
tiff
createjs
xbap
powermock
amazon-elb
reselect
google-cloud-logging
closures
user-defined-types
android-contacts
nose
raml
spring-shell
gollum-wiki
conda
batch-rename
dragula
python-appium
multi-dimensional-scaling
spreadsheetgear
xdebug
php-5.3
monitor
matlab-app-designer
winsock
publishing
mongodb-3.4
sca
gsp
landscape
cordys-opentext
uivisualeffectview
cloudera-quickstart-vm
strapi
telephonymanager
hdiv
flipkart
hypothesis-test
raytracing
robust
flume-twitter
android-webservice
ltrace
elastic4s
scheduledexecutorservice
system.web.optimization
eclemma
vim-plugin
gdl
msgpack
gql
wlanapi
compositetype
google-gdk
ampersand
com0com
azure-xplat-cli
fiware-bosun
juttle
zend-mail
inputbox
visual-studio-6
object-code
windows-messages
.htpasswd
pre
principalcontext
facebook-game-groups
grails-2.3
codahale-metrics
apportable
void-pointers
jquery-lazyload
unicoins
struts2-json-plugin
playorm
android-dialog
popup-blocker
uitextfielddelegate
pageheap
pcspim
yuidoc
glassfish-esb
datacontracts
3des
bass
cleartype
comment-conventions
activex-exe
rootkit
account-management
synthesizer

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile