# Delete by id

**URL:** <https://discuss.elastic.co/t/delete-by-id/3582>\
**Category:** Elasticsearch\
**Created:** [November 17, 2010, 7:24pm UTC](https://discuss.elastic.co/t/delete-by-id/3582 "2010-11-17T19:24:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mooky](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@mooky](https://discuss.elastic.co/u/mooky)\
**Post date:** [November 17, 2010, 7:24pm UTC](https://discuss.elastic.co/t/delete-by-id/3582/1 "2010-11-17T19:24:27Z")

</div>

Is there simple way to delete a document by id?  
(without having to build a query)

---

<div class="post-metadata">

**Author:** ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)\
**Post date:** [November 17, 2010, 7:53pm UTC](https://discuss.elastic.co/t/delete-by-id/3582/2 "2010-11-17T19:53:54Z")

</div>

On Wed, 2010-11-17 at 11:24 -0800, Mooky wrote:

> Is there simple way to delete a document by id?  
> (without having to build a query)

curl -XDELETE '[http://127.0.0.1:9200/my\_index/my\_type/123](http://127.0.0.1:9200/my_index/my_type/123)'

Amazing what one can find in the docs 😉

[http://www.elasticsearch.com/docs/elasticsearch/rest\_api/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/)

---

<div class="post-metadata">

**Author:** ![mooky](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@mooky](https://discuss.elastic.co/u/mooky)\
**Post date:** [November 17, 2010, 11:43pm UTC](https://discuss.elastic.co/t/delete-by-id/3582/3 "2010-11-17T23:43:57Z")

</div>

Sorry. I didnt add some context to my question - Im working with the java  
api.  
(java api docs are pretty light/sparse)

-Nick

On 17 November 2010 19:53, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk) wrote:

> On Wed, 2010-11-17 at 11:24 -0800, Mooky wrote:
> 
> > Is there simple way to delete a document by id?  
> > (without having to build a query)
> 
> curl -XDELETE '[http://127.0.0.1:9200/my\_index/my\_type/123](http://127.0.0.1:9200/my_index/my_type/123)'
> 
> Amazing what one can find in the docs 😉
> 
> [http://www.elasticsearch.com/docs/elasticsearch/rest\_api/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/)

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 18, 2010, 12:04am UTC](https://discuss.elastic.co/t/delete-by-id/3582/4 "2010-11-18T00:04:25Z")

</div>

Something wrong with this method on the client (the javadoc does not look  
sparse to me, but if it does to you, you are more than welcomed to send a  
pull request with improvements):

```
/**
 * Deletes a document from the index based on the index, type and id.
 *
 * @param index The index to delete the document from
 * @param type The type of the document to delete
 * @param id The id of the document to delete
 */
DeleteRequestBuilder prepareDelete(String index, String type, String

```

id);

On Thu, Nov 18, 2010 at 1:43 AM, Nick Minutello [nick.minutello@gmail.com](mailto:nick.minutello@gmail.com)wrote:

> Sorry. I didnt add some context to my question - Im working with the java  
> api.  
> (java api docs are pretty light/sparse)
> 
> -Nick
> 
> On 17 November 2010 19:53, Clinton Gormley [clinton@iannounce.co.uk](mailto:clinton@iannounce.co.uk)wrote:
> 
> > On Wed, 2010-11-17 at 11:24 -0800, Mooky wrote:
> > 
> > > Is there simple way to delete a document by id?  
> > > (without having to build a query)
> > 
> > curl -XDELETE '[http://127.0.0.1:9200/my\_index/my\_type/123](http://127.0.0.1:9200/my_index/my_type/123)'
> > 
> > Amazing what one can find in the docs 😉
> > 
> > [http://www.elasticsearch.com/docs/elasticsearch/rest\_api/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/)

---

<div class="post-metadata">

**Author:** ![mooky](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@mooky](https://discuss.elastic.co/u/mooky)\
**Post date:** [November 18, 2010, 5:01am UTC](https://discuss.elastic.co/t/delete-by-id/3582/5 "2010-11-18T05:01:29Z")

</div>

My Bad. I was looking at prepareDeleteByQuery ... momentary  
blindness :-/

On Nov 18, 12:04 am, Shay Banon [shay.ba...@elasticsearch.com](mailto:shay.ba...@elasticsearch.com) wrote:

> Something wrong with this method on the client (the javadoc does not look  
> sparse to me, but if it does to you, you are more than welcomed to send a  
> pull request with improvements):
> 
> ```
> /**
> * Deletes a document from the index based on the index, type and id.
> *
> * @param index The index to delete the document from
> * @param type The type of the document to delete
> * @param id The id of the document to delete
> */
> DeleteRequestBuilder prepareDelete(String index, String type, String
> 
> ```
> 
> id);
> 
> On Thu, Nov 18, 2010 at 1:43 AM, Nick Minutello [nick.minute...@gmail.com](mailto:nick.minute...@gmail.com)wrote:
> 
> > Sorry. I didnt add some context to my question - Im working with the java  
> > api.  
> > (java api docs are pretty light/sparse)
> 
> > -Nick
> 
> > On 17 November 2010 19:53, Clinton Gormley [clin...@iannounce.co.uk](mailto:clin...@iannounce.co.uk)wrote:
> 
> > > On Wed, 2010-11-17 at 11:24 -0800, Mooky wrote:
> > > 
> > > > Is there simple way to delete a document by id?  
> > > > (without having to build a query)
> 
> > > curl -XDELETE '[http://127.0.0.1:9200/my\_index/my\_type/123](http://127.0.0.1:9200/my_index/my_type/123)'
> 
> > > Amazing what one can find in the docs 😉
> 
> > > [http://www.elasticsearch.com/docs/elasticsearch/rest\_api/](http://www.elasticsearch.com/docs/elasticsearch/rest_api/)

---

<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:** [July 6, 2017, 4:16am UTC](https://discuss.elastic.co/t/delete-by-id/3582/6 "2017-07-06T04:16:19Z")

</div>


