# Filter is occasionally including wrong results

**URL:** <https://discuss.elastic.co/t/filter-is-occasionally-including-wrong-results/236544>\
**Category:** Elasticsearch\
**Created:** [June 10, 2020, 4:00pm UTC](https://discuss.elastic.co/t/filter-is-occasionally-including-wrong-results/236544 "2020-06-10T16:00:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Will\_Monk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/will_monk/32/69726_2.png) [@Will\_Monk](https://discuss.elastic.co/u/Will_Monk)\
**Post date:** [June 10, 2020, 4:00pm UTC](https://discuss.elastic.co/t/filter-is-occasionally-including-wrong-results/236544/1 "2020-06-10T16:00:28Z")

</div>

Cluster summary:

```auto
8 GB RAM
240 GB storage
1 node
2 zones
Version 7.4.2

46 shards

```

Query:

```auto
{
  "query": {
    "bool": {
      "filter": [
        {
          "term": {
            "id": "uuid"
          }
        },
        {
          "term": {
            "type": "text"
          }
        },
        {
          "nested": {
            "path": "accounts",
            "query": {
              "bool": {}
            }
          }
        }
      ]
    }
  },
  "from": 0,
  "size": "10",
  "sort": [
    {
      "createdAt": "asc"
    }
  ]
}

```

Mappings for searched fields

```auto
{
  "mapping": {
    "properties": {
      "type": {
        "type": "keyword"
      },
      "id": {
        "type": "keyword"
      }
    }
  }
}

```

Some times this query is returning results which should have been filtered by by the two term filters. There are no warnings in the logs. The index has ~80k documents, and is reporting ~75MB of data. There never seems to be a CPU/Mem event that coincides with this bard result. I have setup all the mappings for this index, they haven't been inferred. Around the last time this happened, it is reported that Search Rate went to 1/s, and indexing rate to 0.2/s, and JVM at 70% - these don't seem especially high?

We are using [https://elastic-builder.js.org](https://elastic-builder.js.org) to generate the above query, so can rule our any threading issues with overlapping queries.

I should add that this is happening on another index in the same cluster. And I am unable to reproduce when using the devtools in Kibana.

Any ideas what could be causing this, or how to fix?

More details on the index:

```auto
General
Health green
Primaries 1
Docs Count 81144
Storage Size 73.6mb
Aliases none
Status open
Replicas 1

```

---

<div class="post-metadata">

**Author:** ![Will\_Monk](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/will_monk/32/69726_2.png) [@Will\_Monk](https://discuss.elastic.co/u/Will_Monk)\
**Post date:** [June 15, 2020, 8:05am UTC](https://discuss.elastic.co/t/filter-is-occasionally-including-wrong-results/236544/2 "2020-06-15T08:05:19Z")

</div>

Can anyone help with this?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 13, 2020, 8:10am UTC](https://discuss.elastic.co/t/filter-is-occasionally-including-wrong-results/236544/3 "2020-07-13T08:10:27Z")

</div>

Closed on July 13, 2020, 8:10am UTC

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