Potential bug found: why these queries return different results?


(Ben George) #1

This original topic was regarding version 1.3.4. I tested against 1.7.2 and it appears to work as expected returning same results for both queries (ie: the has_parent filter actually works). Frustratingly it also works in 0.20.2, the previous version of ES that we used!

Having incorrect results return from queries could prove fatal for a search product. This is now the 2nd bug we have found that results in inconsistent or incorrect search results since upgrading from 0.20.2 -> 1.7.2.

I have two queries that I thought should return identical results, can anyone tell me why they would return different results ?

There are NO journalist documents with media_categories_id 4.

First query returns 2 results.

{
  "query": {
    "constant_score": {
      "filter": {
        "has_parent": {
          "type": "journalist",
          "query": {
            "terms": {
              "media_categories_id": [
                4
              ]
            }
          }
        }
      }
    }
  }
}

Second query returns 0 results as expected.

{
  "query": {
    "has_parent": {
      "type": "journalist",
      "query": {
        "terms": {
          "media_categories_id": [
            4
          ]
        }
      }
    }
  }
}

(system) #2