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":{"query":"_exists_:(foo bar)"}} default operator behavior is different between 2.4.4 and 6.2.3 #31297

Closed
bczifra opened this issue Jun 13, 2018 · 4 comments
Labels
:Search/Search Search-related issues that do not fall into other categories

Comments

@bczifra
Copy link
Member

bczifra commented Jun 13, 2018

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

Plugins installed: x-pack

JVM version (java -version): 1.8.0_91

OS version (uname -a if on a Unix-like system): macOS 10.12.5

Description of the problem including expected versus actual behavior:
{"query_string":{"query":"_exists_:(foo bar)"}} used to match if a document had either field foo or field bar. Now it tries to match a field named foo bar instead.

Steps to reproduce:

POST exists/doc/1
{
  "foo": "bar"
}

#matches in 2.4.4, no match in 6.2.3
GET exists/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "_exists_:(foo bar)"
          }
        }
      ]
    }
  }
}

#matches in both
GET exists/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "_exists_:(foo OR bar)"
          }
        }
      ]
    }
  }
}

#matches in 2.4.4, no match in 6.2.3
GET exists/_search
{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "_exists_:(foo bar)",
            "default_operator": "OR"
          }
        }
      ]
    }
  }
}

It appears that this might have changed in 6.1.
Using the explain API indicates that this is how the query is treated across the various versions:

  • 2.4: +(ConstantScore(ConstantScore(_field_names:foo)) ConstantScore(ConstantScore(_field_names:bar)))
  • 5.x: +(ConstantScore(_field_names:foo) ConstantScore(_field_names:bar))
  • 6.x: ConstantScore(DocValuesFieldExistsQuery [field=foo bar])
@danielmitterdorfer danielmitterdorfer added the :Search/Search Search-related issues that do not fall into other categories label Jun 15, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

@jtibshirani
Copy link
Contributor

jtibshirani commented Jun 29, 2018

Hi @bczifra, thanks for the very detailed issue description. I think there are two changes here that are causing the differences in the explain output, one that affects which results are returned, and another that shouldn't be relevant:

I hope that helps explain why the difference is occurring. It would be useful to know: did you raise this issue because it could have potentially been a bug, or do you have a use case where the new behavior is hurting usability?

@javanna
Copy link
Member

javanna commented Aug 17, 2018

ping @bczifra can you answer the question above? Are you ok with the given explanation?

@cbuescher
Copy link
Member

Checked with @bczifra that it is okay to close here. He will reopen if there are any follow-up questions.

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

No branches or pull requests

6 participants