# How does bulk API utilize active threads of write thread pool?

**URL:** https://discuss.elastic.co/t/how-does-bulk-api-utilize-active-threads-of-write-thread-pool/185444
**Category:** Elasticsearch
**Created:** [June 12, 2019, 2:35pm UTC](https://discuss.elastic.co/t/how-does-bulk-api-utilize-active-threads-of-write-thread-pool/185444 "2019-06-12T14:35:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![NairitiSharma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nairitisharma/32/68360_2.png) [@NairitiSharma](https://discuss.elastic.co/u/NairitiSharma)
#### Post date: [June 12, 2019, 2:35pm UTC](https://discuss.elastic.co/t/how-does-bulk-api-utilize-active-threads-of-write-thread-pool/185444/1 "2019-06-12T14:35:25Z")

</div>

How does bulk API utilize active threads of thread pool? I have an index with 1 shard and 1 replica. When I push , say 100 documents, using bulk API to this index, will it employ 1 thread of write thread pool to do the ingests?

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [June 13, 2019, 6:36am UTC](https://discuss.elastic.co/t/how-does-bulk-api-utilize-active-threads-of-write-thread-pool/185444/2 "2019-06-13T06:36:32Z")

</div>

Roughly speaking, yes, each bulk request is processed by a single `write` thread on each shard.

---

<div class="post-metadata">

### Author: ![NairitiSharma](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nairitisharma/32/68360_2.png) [@NairitiSharma](https://discuss.elastic.co/u/NairitiSharma)
#### Post date: [June 13, 2019, 6:52am UTC](https://discuss.elastic.co/t/how-does-bulk-api-utilize-active-threads-of-write-thread-pool/185444/3 "2019-06-13T06:52:07Z")

</div>

My indexes have 1 shard and 1 replica. Does this mean one thread will write to both the primary shard and its replica?

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [June 13, 2019, 8:05am UTC](https://discuss.elastic.co/t/how-does-bulk-api-utilize-active-threads-of-write-thread-pool/185444/4 "2019-06-13T08:05:40Z")

</div>

No, that can't happen: the primary and the replica are on different nodes, so they are in different processes and normally on different machines. There's no way that a single thread can do both writes.

---

<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 11, 2019, 8:05am UTC](https://discuss.elastic.co/t/how-does-bulk-api-utilize-active-threads-of-write-thread-pool/185444/5 "2019-07-11T08:05:44Z")

</div>

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