# Delete by query

**URL:** <https://discuss.elastic.co/t/delete-by-query/254847>\
**Category:** Elasticsearch\
**Created:** [November 10, 2020, 4:52am UTC](https://discuss.elastic.co/t/delete-by-query/254847 "2020-11-10T04:52:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikramaddagulla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikramaddagulla/32/139858_2.png) [@vikramaddagulla](https://discuss.elastic.co/u/vikramaddagulla)\
**Post date:** [November 10, 2020, 4:52am UTC](https://discuss.elastic.co/t/delete-by-query/254847/1 "2020-11-10T04:52:17Z")

</div>

Hello,

I would like to delete some data in the index older than a certain time...

I am trying to use the delete by query index...However, before trying to delete the data, I am trying to view the data older than the time frame..

`POST ohsaccesslogsindex/_search { "query":{ "range":{ "@timestamp":{ "gt" : "2020-06-28T04:57:34.000Z"} } } }`

By running the above, I get "No requests in range"

I tried checking the data by the GET API and could see that there is data present since April...

Could you please confirm what is it that I am doing wrong here ?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [November 10, 2020, 8:40am UTC](https://discuss.elastic.co/t/delete-by-query/254847/2 "2020-11-10T08:40:34Z")

</div>

Few questions:

- what is the version?
- what does a document look like?
- what is the mapping?

---

<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 8, 2020, 8:40am UTC](https://discuss.elastic.co/t/delete-by-query/254847/3 "2020-12-08T08:40:34Z")

</div>

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