# How to delete documents in an index based on condition in elastic search

**URL:** https://discuss.elastic.co/t/how-to-delete-documents-in-an-index-based-on-condition-in-elastic-search/169806
**Category:** Elasticsearch
**Created:** [February 25, 2019, 11:12am UTC](https://discuss.elastic.co/t/how-to-delete-documents-in-an-index-based-on-condition-in-elastic-search/169806 "2019-02-25T11:12:40Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![PRUDHVI\_CHOWDHARY\_NE](https://avatars.discourse-cdn.com/v4/letter/p/9f8e36/32.png) [@PRUDHVI\_CHOWDHARY\_NE](https://discuss.elastic.co/u/PRUDHVI_CHOWDHARY_NE)
#### Post date: [February 25, 2019, 11:12am UTC](https://discuss.elastic.co/t/how-to-delete-documents-in-an-index-based-on-condition-in-elastic-search/169806/1 "2019-02-25T11:12:41Z")

</div>

i have data like name,age,class,registered time in an index called student in my elastic search

i want to delete the documents that are having registered time less than some timestamp(suppose be 15546000xxxxxx).

how can do this ?  
what will be the query to be run in dev console

---

<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: [February 25, 2019, 11:46am UTC](https://discuss.elastic.co/t/how-to-delete-documents-in-an-index-based-on-condition-in-elastic-search/169806/2 "2019-02-25T11:46:36Z")

</div>

You can use the Delete by Query API. See [https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html)

---

<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: [March 25, 2019, 11:46am UTC](https://discuss.elastic.co/t/how-to-delete-documents-in-an-index-based-on-condition-in-elastic-search/169806/3 "2019-03-25T11:46:45Z")

</div>

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