Semantically equivalent search leads to different results

Query [1] (exactly one result) and [2] (many results) differ in their results (quantity), although they are semantically equivalent according to the documentation (see "operator" parameter explanation for in Documentation for "operator" parameter). Is there an explanation for this?

[1]:

GET test/_search
{
  "query": {
    "match": {
      "fulltext": {
        "query" : "Western United States",
        "operator": "and"
      }
    }
  }
}

[2]:

GET test/_search
{
  "query": {
    "match": {
      "fulltext": {
        "query" : "Western AND United AND States"
      }
    }
  }
}

The link you shared is about the query_string query if I'm not mistaken and not about the match query. This should be equivalent I believe

GET /_search
{
    "query": {
        "query_string" : {
            "query" : "Western AND United AND States",
            "default_field" : "fulltext"
        }
    }
}

or

GET /_search
{
    "query": {
        "query_string" : {
            "query" : "fulltext:Western AND fulltext:United AND fulltext:States"
        }
    }
}

Thank you! The link was wrong, I corrected it.
Beyond that, however, the question remains...

You can't use AND operator in the match query as I said before.

Now I understand, thanks for your help! :slightly_smiling_face:

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