# 502 Error with add data

**URL:** <https://discuss.elastic.co/t/502-error-with-add-data/110672>\
**Category:** Elasticsearch\
**Created:** [December 7, 2017, 12:38pm UTC](https://discuss.elastic.co/t/502-error-with-add-data/110672 "2017-12-07T12:38:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![aneesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aneesh/32/37819_2.png) [@aneesh](https://discuss.elastic.co/u/aneesh)\
**Post date:** [December 7, 2017, 12:38pm UTC](https://discuss.elastic.co/t/502-error-with-add-data/110672/1 "2017-12-07T12:38:42Z")

</div>

Hi

While adding some huge data to elastic search is giving 502 error  
I am trying batch insert of 1000 at a time with Bulk insert.

Thanks  
Aneesh L

---

<div class="post-metadata">

**Author:** ![luiz.santos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luiz.santos/32/24664_2.png) [@luiz.santos](https://discuss.elastic.co/u/luiz.santos)\
**Post date:** [December 15, 2017, 11:09am UTC](https://discuss.elastic.co/t/502-error-with-add-data/110672/2 "2017-12-15T11:09:04Z")

</div>

Hi Aneesh,

What is total size of your 1000 documents? What version of Elasticsearch you are using and how many memory your heap size is configured?

Are you accessing Elasticsearch directly or through a proxy (nginx, apache, etc)?

Best,  
LG

---

<div class="post-metadata">

**Author:** ![aneesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aneesh/32/37819_2.png) [@aneesh](https://discuss.elastic.co/u/aneesh)\
**Post date:** [December 15, 2017, 11:23am UTC](https://discuss.elastic.co/t/502-error-with-add-data/110672/3 "2017-12-15T11:23:50Z")

</div>

Hi Luiz Santos

1. ElasticsearchResponse indexResponse = objClient.Bulk(lstRowsToCache);
  - lstRowsToCache is List of 8000

2. ElasticSearch 6
3. Default Heap Size, I did not configured
4. Directly accessing Elastic Search

Thanks  
Aneesh

---

<div class="post-metadata">

**Author:** ![luiz.santos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luiz.santos/32/24664_2.png) [@luiz.santos](https://discuss.elastic.co/u/luiz.santos)\
**Post date:** [December 15, 2017, 11:32am UTC](https://discuss.elastic.co/t/502-error-with-add-data/110672/4 "2017-12-15T11:32:02Z")

</div>

Hi Aneesh,

It happens that using bulk to 1000 documents of 1kb is very different than 1000 documents of 1Mb. You could try to lower the amount of documents to 100 for example and see if the error continue to happen.

Also, can you provide the log error Elasticsearch is throwing? You can find it in a folder called log inside Elasticsearch folder.

Best,  
LG

---

<div class="post-metadata">

**Author:** ![aneesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aneesh/32/37819_2.png) [@aneesh](https://discuss.elastic.co/u/aneesh)\
**Post date:** [December 15, 2017, 11:46am UTC](https://discuss.elastic.co/t/502-error-with-add-data/110672/5 "2017-12-15T11:46:24Z")

</div>

Hi Luiz Santos

Yes i will try with 100 docs.  
Error will log implicitly or we need to log explicitly.

Thanks  
Aneesh L

---

<div class="post-metadata">

**Author:** ![aneesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aneesh/32/37819_2.png) [@aneesh](https://discuss.elastic.co/u/aneesh)\
**Post date:** [December 19, 2017, 3:15am UTC](https://discuss.elastic.co/t/502-error-with-add-data/110672/6 "2017-12-19T03:15:18Z")

</div>

Hi Luiz Santos

I am trying to to create more than 100 indices in a single service call. Each bulk insert contains max 1000 records. That time i am getting 502 error. When I reduced number of indices that problem solved. But is there any way to create multiple indices in a single service call.

Thanks  
Aneesh L

---

<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:** [December 19, 2017, 5:59am UTC](https://discuss.elastic.co/t/502-error-with-add-data/110672/7 "2017-12-19T05:59:16Z")

</div>

Is that a real use case, creating 100 of indices in a request? Could you explain?

---

<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:** [January 16, 2018, 6:04am UTC](https://discuss.elastic.co/t/502-error-with-add-data/110672/8 "2018-01-16T06:04:26Z")

</div>

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