Stop words if present in query_string query behaving different in elastic 6.2 and 7.5

I'm unable to understand why the below query is behaving differently in the two versions.

{
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "query": "(field1:\"best\"^300 AND fields2:\"DUMMYSTR\"^200)",
            "fields": [],
            "type": "best_fields",
            "phrase_slop": 0,
            "boost": 1
          }
        }
      ],
      "boost": 1
    }
  }
}

Both field1 and field2 use same analyzer. best is a stop word and DUMMYSTR is present in all docs.
In ES 6.2.2 version the query returns 0 documents which is the expected result.
In ES 7.5.2 version the query parser seems to ignore the first part of the query i.e. field1:\"best\"^300 as best is stop word and hence this part of the query has no terms left. Whereas since DUMMYSTR is present in all the documents the second part of the query matches all the docs and the same is returned in the result.

The _validate api with explain returns the same explanation in both the versions which is

{
  "valid": true,
  "_shards": {
    "total": 1,
    "successful": 1,
    "failed": 0
  },
  "explanations": [
    {
      "index": "my_index",
      "valid": true,
      "explanation": """+(+(MatchNoDocsQuery("Matching no documents because no terms present."))^300.0 +(field2:dummystr)^200.0)"""
    }
  ]
}
  1. Which version has the correct behaviour and why different behaviour?
  2. What modification should I do in the query to achieve the same behaviour in ES 7.5 as well? One solution I can think is to create an analyzer to be used in search without the stop words filter. Any other suggestions?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.