# \_bulk request with routing parameter

**URL:** https://discuss.elastic.co/t/bulk-request-with-routing-parameter/288723
**Category:** Elasticsearch
**Tags:** reindex
**Created:** [November 9, 2021, 8:35am UTC](https://discuss.elastic.co/t/bulk-request-with-routing-parameter/288723 "2021-11-09T08:35:29Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Hunter\_Tr\_n](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hunter_tr_n/32/96886_2.png) [@Hunter\_Tr\_n](https://discuss.elastic.co/u/Hunter_Tr_n)
#### Post date: [November 9, 2021, 8:35am UTC](https://discuss.elastic.co/t/bulk-request-with-routing-parameter/288723/1 "2021-11-09T08:35:29Z")

</div>

Currently, I am applying `_bulk` requests for reindexing. Each \_bulk request contains a ton of reindex requests ( creating, updating, or deleting). Each document already has its own `routing`.

I wonder if I apply routing on `_bulk` requests, I will get better performance or not.

To do that, I also need to make sure all documents inside the same \_bulk request have been stored in the same shard.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/0/9/090847d5a8607e3b33c1635eded1b93cb3ae59f0.png)

If the answer is yes, which hashing function I must use to group message on \_bulk request.  
Anyone can help to verify this case.

---

<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: [November 9, 2021, 8:52am UTC](https://discuss.elastic.co/t/bulk-request-with-routing-parameter/288723/2 "2021-11-09T08:52:51Z")

</div>

If you are indexing immutable data this could improve performance as the batch size going to each shard would likely increase. To make sure you spread the load you could use a timestamp or random number as routing key. I am not sure how much impact this may have though.

Why is your diagram showing bulk requests going through a master node?

---

<div class="post-metadata">

### Author: ![Hunter\_Tr\_n](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hunter_tr_n/32/96886_2.png) [@Hunter\_Tr\_n](https://discuss.elastic.co/u/Hunter_Tr_n)
#### Post date: [November 9, 2021, 9:00am UTC](https://discuss.elastic.co/t/bulk-request-with-routing-parameter/288723/3 "2021-11-09T09:00:01Z")

</div>

my \_bulk request contains multiple reindex requests. Each document already contains its routing. I wonder if I apply routing param for the request, can I reduce performance as transport between ES node or not.

---

<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: [December 7, 2021, 9:00am UTC](https://discuss.elastic.co/t/bulk-request-with-routing-parameter/288723/4 "2021-12-07T09:00:55Z")

</div>

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