# Is there any documentation about the query query?

**URL:** <https://discuss.elastic.co/t/is-there-any-documentation-about-the-query-query/66826>\
**Category:** Elasticsearch\
**Created:** [November 22, 2016, 8:47am UTC](https://discuss.elastic.co/t/is-there-any-documentation-about-the-query-query/66826 "2016-11-22T08:47:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AndreKR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrekr/32/6233_2.png) [@AndreKR](https://discuss.elastic.co/u/AndreKR)\
**Post date:** [November 22, 2016, 8:47am UTC](https://discuss.elastic.co/t/is-there-any-documentation-about-the-query-query/66826/1 "2016-11-22T08:47:27Z")

</div>

This is a normal term query:

```
{
  "query": {
    "term" : { "user" : "Kimchy" } 
  }
}

```

I just found out that this is also a valid query:

```
{
  "query": {
    "query": {
      "term" : { "user" : "Kimchy" } 
    }
  }
}

```

Essentially it seems I can use a `query` query anywhere where I can use any of the other queries, and it can wrap any other query.

What is this `query` query and is there any documentation about it?

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [November 22, 2016, 9:26am UTC](https://discuss.elastic.co/t/is-there-any-documentation-about-the-query-query/66826/2 "2016-11-22T09:26:32Z")

</div>

Hi,

There is indeed a `query` query, which only exists for backward compatibility reasons. There used to be a `query` filter in version 1.x ([https://www.elastic.co/guide/en/elasticsearch/reference/1.7/query-dsl-query-filter.html](https://www.elastic.co/guide/en/elasticsearch/reference/1.7/query-dsl-query-filter.html)). In 2.x we merged queries and filters, but to keep existing queries compatible, we had to keep a `query` query which just returns the inner query. This `quey` query is removed in version 5.0.

---

<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:** [December 20, 2016, 9:26am UTC](https://discuss.elastic.co/t/is-there-any-documentation-about-the-query-query/66826/3 "2016-12-20T09:26:49Z")

</div>

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