# Unclear about routing required mapping when deleting

**URL:** <https://discuss.elastic.co/t/unclear-about-routing-required-mapping-when-deleting/41680>\
**Category:** Elasticsearch\
**Created:** [February 13, 2016, 7:36am UTC](https://discuss.elastic.co/t/unclear-about-routing-required-mapping-when-deleting/41680 "2016-02-13T07:36:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jks/32/12997_2.png) [@jks](https://discuss.elastic.co/u/jks)\
**Post date:** [February 13, 2016, 7:36am UTC](https://discuss.elastic.co/t/unclear-about-routing-required-mapping-when-deleting/41680/1 "2016-02-13T07:36:28Z")

</div>

The docs state:

> **[Delete API | Elasticsearch Guide \[2.2\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/2.2/docs-delete.html#delete-routing)**

> Many times, the routing value is not known when deleting a document. For  
> those cases, when specifying the \_routing mapping as required, and  
> no routing value is specified, the delete will be broadcast  
> automatically to all shards.

But in a separate section there seems to be a contradicting statement:

> **[CRUD and routing changes | Elasticsearch Guide \[2.2\] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/2.2/breaking_20_crud_and_routing_changes.html#_delete_api_with_custom_routing)**

> The delete API used to be broadcast to all shards in the index which meant  
> that, when using custom routing, the routing parameter was optional. Now,  
> the delete request is forwarded only to the shard holding the document. If you  
> are using custom routing then you should specify the routing value when  
> deleting a document, just as is already required for the index, create,  
> and update APIs.To make sure that you never forget a routing value, make routing required

Given a custom routing id:

1. If you map routing as required and then do _not_ submit a routing id during DELETE, does it broadcast to all shards, or does it fail?

2. Alternatively, if you don't map routing as required, and then do _not_ submit a routing id during DELETE, does it also broadcast, or does it fail?

---

<div class="post-metadata">

**Author:** ![jks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jks/32/12997_2.png) [@jks](https://discuss.elastic.co/u/jks)\
**Post date:** [February 14, 2016, 5:56am UTC](https://discuss.elastic.co/t/unclear-about-routing-required-mapping-when-deleting/41680/2 "2016-02-14T05:56:32Z")

</div>

I've just tested scenario 1 in my original question on a node with 3 shards:  
I've mapped routing to be required, and it does appear to delete the doc in questions whether I provide a routing id or not. So my guess is that yes, without a routing id the delete does broadcast to all shards.

Still unclear about scenario 2 though.

---

<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 5, 2017, 11:16pm UTC](https://discuss.elastic.co/t/unclear-about-routing-required-mapping-when-deleting/41680/3 "2017-07-05T23:16:33Z")

</div>


