The use case is quite simple, I have the following document:
{
"collected" : {
"etag" : ""KOlSfwGpwASvJB5lLGkjWDc36DY/R9KZ-VQJQP18W3NNaJcSpQlPgaY"",
"is_success" : true,
"action_type" : "password"
},
"timestamp" : 1399820164000,
"instanceId" : 0,
"collected_event" : true,
"tenantId" : 2,
"eventType" : 589825
}
And I try to run a filtered query, that has terms and query_string:
{
"filter" : {
"and" : [{
"term" : {
"tenantId" : 2
}
}, {
"not" : {
"term" : {
"eventType" : 589844
}
}
}, {
"not" : {
"term" : {
"collected_event" : false
}
}
}
]
},
"query" : {
"query_string" : {
"query" : ""sfoun"",
"lenient" : true,
"fields" : ["collected.*"]
}
}
}
I expect the filtered query to yield zero results since the document
doesn't meet with the query_string.
You can try and replace the text in query_string to anything you like but
still get the results.
My guess is that I'm missing out something or I don't fully understand how
queries work.
One side note, if I change the query_string fields to be either
'collected.etag' or 'collected.action_type' the document is filtered
properly.
If I include 'collected.'is_success' I still get the document.
On Tuesday, May 20, 2014 6:43:05 PM UTC+3, Yarin Miran wrote:
Hello,
We've been using elasticsearch for a while now in my company and we
recently discovered that certain queries are returning unwanted results.
The use case is quite simple, I have the following document:
{
"collected" : {
"etag" : ""KOlSfwGpwASvJB5lLGkjWDc36DY/R9KZ-VQJQP18W3NNaJcSpQlPgaY"",
"is_success" : true,
"action_type" : "password"
},
"timestamp" : 1399820164000,
"instanceId" : 0,
"collected_event" : true,
"tenantId" : 2,
"eventType" : 589825
}
And I try to run a filtered query, that has terms and query_string:
{
"filter" : {
"and" : [{
"term" : {
"tenantId" : 2
}
}, {
"not" : {
"term" : {
"eventType" : 589844
}
}
}, {
"not" : {
"term" : {
"collected_event" : false
}
}
}
]
},
"query" : {
"query_string" : {
"query" : ""sfoun"",
"lenient" : true,
"fields" : ["collected.*"]
}
}
}
I expect the filtered query to yield zero results since the document
doesn't meet with the query_string.
You can try and replace the text in query_string to anything you like but
still get the results.
My guess is that I'm missing out something or I don't fully understand how
queries work.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.