Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query_string with Exact string match with in double quote does not select specific field for search #66665

Closed
sivamforeverd opened this issue Dec 20, 2020 · 1 comment
Labels
>bug needs:triage Requires assignment of a team area label

Comments

@sivamforeverd
Copy link

sivamforeverd commented Dec 20, 2020

Elasticsearch version (bin/elasticsearch --version):
7.9.3

Plugins installed: []

JVM version (java -version):
JVM: 1.8.0_275

OS version (uname -a if on a Unix-like system):
Linux version 5.4.0-54-generic (buildd@lcy01-amd64-024) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #60-Ubuntu SMP Fri Nov 6 10:37:59 UTC 2020

Description of the problem including expected versus actual behavior:
When query_string is used for search along with quoted string, the key is not considered properly. Search is initiated across all the keys

Steps to reproduce:

DELETE /test
GET /test
PUT /test
PUT /test/_mapping
{ "properties" : {
"value1" : {
"type" : "text"
},
"value2" : {
"type" : "text"
}
}
}

POST /test/_doc/1
{
"value1":"red small",
"value2":"red2"
}

POST /test/_doc/2
{
"value1":"small",
"value2":"reddd"
}

POST /test/_search
{
"query":{
"query_string": {
"query": "value2:="red small""
}
}
}

** Above search returns doc "1", but it should not, Since we are looking for "red small" in value2 key and no document is available in the index like this

Above scenario applicable for below mapping also

DELETE /test

GET /test
PUT /test
PUT /test/_mapping
{ "properties" : {
"value1" : {
"type" : "keyword"
},
"value2" : {
"type" : "keyword"
}
}
}

"Color:=(red OR blue)" => This query_string searches for red or blue in all fields, not only in Color
"Color:=red OR Color:=blue" => This query_string works as expected, searches only in Color field

@sivamforeverd sivamforeverd added >bug needs:triage Requires assignment of a team area label labels Dec 20, 2020
@sivamforeverd
Copy link
Author

Instead of "Color:=(red OR blue)" should use "Color:(red OR blue)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug needs:triage Requires assignment of a team area label
Projects
None yet
Development

No branches or pull requests

1 participant