# Strange issue with Elasticsearch while bulk indexing

**URL:** <https://discuss.elastic.co/t/strange-issue-with-elasticsearch-while-bulk-indexing/217653>\
**Category:** Elasticsearch\
**Created:** [February 3, 2020, 3:40pm UTC](https://discuss.elastic.co/t/strange-issue-with-elasticsearch-while-bulk-indexing/217653 "2020-02-03T15:40:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![giorgio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/giorgio/32/61978_2.png) [@giorgio](https://discuss.elastic.co/u/giorgio)\
**Post date:** [February 3, 2020, 3:40pm UTC](https://discuss.elastic.co/t/strange-issue-with-elasticsearch-while-bulk-indexing/217653/1 "2020-02-03T15:40:32Z")

</div>

Hi I have bit of strange issue with elasticsearch, I have 30 shards 0 replicas and currently 14 million documents. I Bulk index using NEST like this:  
public static bool MultiIndex(List objects) where T : someclass  
{  
bool a = false;  
var bulkall = Program.\_elasticclient.BulkAll(objects, b =\>  
b.Index("indexname")  
.BackOffRetries(2)  
.BackOffTime("30s")  
.RefreshOnCompleted()  
.MaxDegreeOfParallelism(5)  
.Size(10000));  
bulkall.Subscribe(new BulkAllObserver(  
onNext: (b) =\> { Console.WriteLine("inserted 10k"); },  
onError: (e) =\> { throw e; },  
onCompleted: () =\> a = true));  
return a;  
}  
I have few servers running which process data and then index like that. I had no issue until now but after data grew, now that those servers multiindex few times elasticsearch becomes unresponsive and unusable for a while. How could I resolve this?

p.s each time I call MultiIndex I pass around 10-30k or so documents. each document is around 2kb  
p.ss I gave it 16gb java heap.

---

<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:** [February 3, 2020, 4:53pm UTC](https://discuss.elastic.co/t/strange-issue-with-elasticsearch-while-bulk-indexing/217653/2 "2020-02-03T16:53:43Z")

</div>

I would recommend sending smaller batches. Aim for around 5 MB per request.

---

<div class="post-metadata">

**Author:** ![giorgio](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/giorgio/32/61978_2.png) [@giorgio](https://discuss.elastic.co/u/giorgio)\
**Post date:** [February 3, 2020, 4:55pm UTC](https://discuss.elastic.co/t/strange-issue-with-elasticsearch-while-bulk-indexing/217653/3 "2020-02-03T16:55:22Z")

</div>

I set refresh\_interval to -1 before bulk indexing and then to 1s after I am done. Problem seems fixed. 😃

---

<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:** [March 2, 2020, 4:55pm UTC](https://discuss.elastic.co/t/strange-issue-with-elasticsearch-while-bulk-indexing/217653/4 "2020-03-02T16:55:30Z")

</div>

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