# ES fails with no \[query\] registered for \[filtered\]

**URL:** <https://discuss.elastic.co/t/es-fails-with-no-query-registered-for-filtered/139592>\
**Category:** Elasticsearch\
**Created:** [July 11, 2018, 2:09pm UTC](https://discuss.elastic.co/t/es-fails-with-no-query-registered-for-filtered/139592 "2018-07-11T14:09:29Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bogdan\_Popa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bogdan_popa/32/33238_2.png) [@Bogdan\_Popa](https://discuss.elastic.co/u/Bogdan_Popa)\
**Post date:** [July 11, 2018, 2:09pm UTC](https://discuss.elastic.co/t/es-fails-with-no-query-registered-for-filtered/139592/1 "2018-07-11T14:09:29Z")

</div>

Elasticsearch fails with

`[{"type":"parsing_exception","reason":"no [query] registered for [filtered]"`

```
{
  query: {
    filtered: {
      filter: {
        bool: {
          must: must_terms,
          must_not: must_not_terms,
          should: should_terms,
        },
      },
    },
  },
  aggs: aggregation,
  sort: sort,
  size: amount_of_results,
}

```

How can I rewrite the query according to ES 5.0+ updates?  
I know filtered is deprecated, but I cannot seem to make it work.

I tried changing the query to:

```
{
  query: {
    bool: {
      must: must_terms,
      must_not: must_not_terms,
      should: should_terms,
    },
  },
  aggs: aggregation,
  sort: sort,
  size: amount_of_results,
}

```

But now the query doesn't yield any result.

---

<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:** [August 8, 2018, 2:09pm UTC](https://discuss.elastic.co/t/es-fails-with-no-query-registered-for-filtered/139592/2 "2018-08-08T14:09:34Z")

</div>

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