# Elasticsearch query

**URL:** <https://discuss.elastic.co/t/elasticsearch-query/283575>\
**Category:** Elasticsearch\
**Created:** [September 7, 2021, 7:24pm UTC](https://discuss.elastic.co/t/elasticsearch-query/283575 "2021-09-07T19:24:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Elk\_huh](https://avatars.discourse-cdn.com/v4/letter/e/d26b3c/32.png) [@Elk\_huh](https://discuss.elastic.co/u/Elk_huh)\
**Post date:** [September 7, 2021, 7:24pm UTC](https://discuss.elastic.co/t/elasticsearch-query/283575/1 "2021-09-07T19:24:19Z")

</div>

My siem only allows any querys inside query{}

I need to do a sort by date like this but the sort needs to be inside the query , any ideas

```auto
GET /index-*/_search
{
  "sort" : [
    { "@timestamp" : {"order": "desc"}}
  ],
  "query" : {
        "match_all": {}
  }
}

```

---

<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:** [October 5, 2021, 7:24pm UTC](https://discuss.elastic.co/t/elasticsearch-query/283575/2 "2021-10-05T19:24:34Z")

</div>

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