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

QueryString query - quoted _exists_ query returns no result #28922

Closed
nikoncode opened this issue Mar 7, 2018 · 4 comments · Fixed by #33019
Closed

QueryString query - quoted _exists_ query returns no result #28922

nikoncode opened this issue Mar 7, 2018 · 4 comments · Fixed by #33019
Assignees
Labels
>bug :Search/Search Search-related issues that do not fall into other categories

Comments

@nikoncode
Copy link
Contributor

nikoncode commented Mar 7, 2018

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

Plugins installed: []

JVM version (java -version): OpenJDK Runtime Environment (build 1.8.0_162-b01)

OS version (uname -a if on a Unix-like system): Linux mikita-pc 4.14.20-2-MANJARO #1 SMP PREEMPT Sat Feb 17 21:47:27 CET 2018 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:
_exists_: test - works (converted in NormsFieldExistsQuery),
_exists_: \"test\" - doesn't work (converted in MatchNoDocsQuery("unmapped field [_exists_]")).
It's not possible to use _exists_ in query_string query with fields which contains spaces in name (it works in es 1.7)

Steps to reproduce:

POST localhost:9200/tests/test/1
{
	"name": "aa"
}

POST localhost:9200/tests/test/_search (returns document, expected)
{
   "query":{
      "query_string":{
         "query":"_exists_: name"
      }
   }
}

POST localhost:9200/tests/test/_search (returns nothing, not expected but works in ES 1.7)
{
   "query":{
      "query_string":{
         "query":"_exists_: \"name\""
      }
   }
}

It's impossible to use exists query with field with spaces:

POST localhost:9200/tests/test/1
{
	"na me": "aa"
}

POST localhost:9200/tests/test/_search (returns nothing, expected)
{
   "query":{
      "query_string":{
         "query":"_exists_: na me"
      }
   }
}

POST localhost:9200/tests/test/_search (returns nothing, not expected, works in ES 1.7)
{
   "query":{
      "query_string":{
         "query":"_exists_: \"na me\""
      }
   }
}
@nikoncode nikoncode changed the title QueryString query - quoted exists query returns no result QueryString query - quoted _exists_ query returns no result Mar 7, 2018
@spinscale spinscale added the :Search/Search Search-related issues that do not fall into other categories label Mar 7, 2018
@spinscale
Copy link
Contributor

@elastic/es-search-aggs can you take a look?

One can use "query":"_exists_:na\\ me" to get the desired result, though I am not sure if the above syntax is expected to work as well

@jimczi
Copy link
Contributor

jimczi commented Mar 9, 2018

This is a regression, we should accept the quoted version (e.g. _exists_:"na me"). I'll work on a fix.

@jimczi jimczi added >bug and removed discuss labels Mar 9, 2018
@jimczi jimczi self-assigned this Mar 9, 2018
@nikoncode
Copy link
Contributor Author

@jimczi since no progress on this issue, would you mind if I try to fix it by myself?

jimczi added a commit to jimczi/elasticsearch that referenced this issue Aug 21, 2018
This change in the `query_string` query fixes the detection of the special
`_exists_` field when it is used with a quoted term.

Closes elastic#28922
@jimczi
Copy link
Contributor

jimczi commented Aug 21, 2018

Sorry for the delay @nikoncode , this issue slipped through the cracks. I opened #33019 to fix it.

jimczi added a commit that referenced this issue Aug 21, 2018
This change in the `query_string` query fixes the detection of the special
`_exists_` field when it is used with a quoted term.

Closes #28922
jimczi added a commit that referenced this issue Aug 21, 2018
This change in the `query_string` query fixes the detection of the special
`_exists_` field when it is used with a quoted term.

Closes #28922
jimczi added a commit that referenced this issue Aug 21, 2018
This change in the `query_string` query fixes the detection of the special
`_exists_` field when it is used with a quoted term.

Closes #28922
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Search/Search Search-related issues that do not fall into other categories
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants