# We use id to update or delete without routing. I can't find this document. Is there a way to broadcast this operation without routing to all shards?

**URL:** <https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599>\
**Category:** Elasticsearch\
**Created:** [July 17, 2020, 7:51am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599 "2020-07-17T07:51:11Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liyes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/liyes/32/64705_2.png) [@Liyes](https://discuss.elastic.co/u/Liyes)\
**Post date:** [July 17, 2020, 7:51am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599/1 "2020-07-17T07:51:11Z")

</div>

Our index has 3 primary shards. Previously, id was used for routing by default. Now we need to change to use another field as routing, and create a docuemnt based on this routing, but when we do update or delete operation by id, we don’t know what the routing is, we can’t find this document. Is there any good suggestions? Or is there a way to broadcast this operation without routing to all shards?  
Thank you very much.

---

<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:** [July 17, 2020, 8:40am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599/2 "2020-07-17T08:40:14Z")

</div>

Please make your title shorter.

Why are you using routing for?

> Or is there a way to broadcast this operation without routing to all shards?

You can do something like update by query and delete by query which will run a search + the update or delete operation. I'm not sure if this is super efficient though.

---

<div class="post-metadata">

**Author:** ![Liyes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/liyes/32/64705_2.png) [@Liyes](https://discuss.elastic.co/u/Liyes)\
**Post date:** [July 17, 2020, 8:43am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599/3 "2020-07-17T08:43:11Z")

</div>

I know routing when searching, but I don’t know routing when searching documents by id.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 17, 2020, 8:44am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599/4 "2020-07-17T08:44:34Z")

</div>

Why are you using routing? How many primary shards do you have? What is the ratio between indexing and search requests?

---

<div class="post-metadata">

**Author:** ![Liyes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/liyes/32/64705_2.png) [@Liyes](https://discuss.elastic.co/u/Liyes)\
**Post date:** [July 17, 2020, 8:46am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599/5 "2020-07-17T08:46:21Z")

</div>

> [@Christian\_Dahlqvist](#):
>
> Why are you using routing? How many primary shards do you have? What is the ratio between indexing and search requests?

I have a field, and I want to make the data of the same field to a shard so that the performance can be better. I now have three shared.There will be a little more search requests.

---

<div class="post-metadata">

**Author:** ![Liyes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/liyes/32/64705_2.png) [@Liyes](https://discuss.elastic.co/u/Liyes)\
**Post date:** [July 17, 2020, 8:49am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599/7 "2020-07-17T08:49:04Z")

</div>

I have a field, and I want to make the data of the same field to a shard so that the performance can be better. I now have three shared.There will be a little more search requests.

---

<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:** [July 17, 2020, 9:01am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599/8 "2020-07-17T09:01:23Z")

</div>

What is the size of the whole index? In number of documents and size on disk?

---

<div class="post-metadata">

**Author:** ![Liyes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/liyes/32/64705_2.png) [@Liyes](https://discuss.elastic.co/u/Liyes)\
**Post date:** [July 17, 2020, 9:06am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599/9 "2020-07-17T09:06:05Z")

</div>

> [@dadoonet](#):
>
> What is the size of the whole index? In number of documents and size on disk?

The total number of index14.7GB. Index number is 129728679.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 17, 2020, 9:22am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599/10 "2020-07-17T09:22:55Z")

</div>

Adding routing does complicate things, especially when you do not know the value after initial indexing. Have you benchmarked and measured the impact routing has? Is it worth it?

If your load is mixed it may not be worth the extra work at indexing time.

---

<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:** [July 17, 2020, 9:33am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599/11 "2020-07-17T09:33:29Z")

</div>

I believe that only one shard might be enough to hold all the data. Something you need to test though but in that case you'll probably avoid complexity and still have a very good response time.

---

<div class="post-metadata">

**Author:** ![Liyes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/liyes/32/64705_2.png) [@Liyes](https://discuss.elastic.co/u/Liyes)\
**Post date:** [July 17, 2020, 10:07am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599/12 "2020-07-17T10:07:55Z")

</div>

> [@dadoonet](#):
>
> I believe that only one shard might be enough to hold all the data. Something you need to test though but in that case you'll probably avoid complexity and still have a very good response time.

Thank you very much. But our data will increase in the future.

---

<div class="post-metadata">

**Author:** ![Liyes](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/liyes/32/64705_2.png) [@Liyes](https://discuss.elastic.co/u/Liyes)\
**Post date:** [July 17, 2020, 10:09am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599/13 "2020-07-17T10:09:08Z")

</div>

> [@Christian\_Dahlqvist](#):
>
> Adding routing does complicate things, especially when you do not know the value after initial indexing. Have you benchmarked and measured the impact routing has? Is it worth it?
> 
> If your load is mixed it may not be worth the extra work at indexing time.

I will carefully consider this issue, thank you very much.

---

<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:** [August 14, 2020, 10:09am UTC](https://discuss.elastic.co/t/we-use-id-to-update-or-delete-without-routing-i-cant-find-this-document-is-there-a-way-to-broadcast-this-operation-without-routing-to-all-shards/241599/14 "2020-08-14T10:09:09Z")

</div>

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