# Why delete document by id not support index wildcard

**URL:** <https://discuss.elastic.co/t/why-delete-document-by-id-not-support-index-wildcard/117010>\
**Category:** Elasticsearch\
**Created:** [January 25, 2018, 9:10am UTC](https://discuss.elastic.co/t/why-delete-document-by-id-not-support-index-wildcard/117010 "2018-01-25T09:10:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zt\_Zeng](https://avatars.discourse-cdn.com/v4/letter/z/b77776/32.png) [@Zt\_Zeng](https://discuss.elastic.co/u/Zt_Zeng)\
**Post date:** [January 25, 2018, 9:10am UTC](https://discuss.elastic.co/t/why-delete-document-by-id-not-support-index-wildcard/117010/1 "2018-01-25T09:10:12Z")

</div>

Recently, I found that the delete document by id have to through delete by query.

```
POST /blog-*/messages/_delete_by_query?pretty
{
  "query": {
    "match": {
      "_id": "N1H$K4Xtsra"
    }
  }
}

```

Is there any plan to add support for wildcard for delete by id?

```
DELETE /blog-*/messages/N1H$K4Xtsra
```

---

<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:** [January 25, 2018, 9:31am UTC](https://discuss.elastic.co/t/why-delete-document-by-id-not-support-index-wildcard/117010/2 "2018-01-25T09:31:51Z")

</div>

Such a request is supposed to do directly to one specific shard to DELETE a single document.

For the same reason as you can't do `PUT test*/doc/1`, you can't do a `DELETE test*/doc/1`.

When you mean to remove multiple documents, elasticsearch needs first to locate where the documents are (by running a query) and then elasticsearch needs to delete each of them, one by one.

This is what a DELETE BY QUERY is exactly doing behind the scene:

- search
- bulk delete

---

<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:** [February 22, 2018, 9:31am UTC](https://discuss.elastic.co/t/why-delete-document-by-id-not-support-index-wildcard/117010/3 "2018-02-22T09:31:53Z")

</div>

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