# Bulk Import to Elasticsearch

**URL:** <https://discuss.elastic.co/t/bulk-import-to-elasticsearch/106644>\
**Category:** Elasticsearch\
**Created:** [November 7, 2017, 8:39am UTC](https://discuss.elastic.co/t/bulk-import-to-elasticsearch/106644 "2017-11-07T08:39:27Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Biraj\_Dhungel](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@Biraj\_Dhungel](https://discuss.elastic.co/u/Biraj_Dhungel)\
**Post date:** [November 7, 2017, 8:39am UTC](https://discuss.elastic.co/t/bulk-import-to-elasticsearch/106644/1 "2017-11-07T08:39:27Z")

</div>

Hello,  
I have a JSON file of 1 GB Logdata. The format of the file is

{ "index" : { "\_index" : "test", "\_type" : "type1" } }  
{ "field1" : "value1" }  
{ "index" : { "\_index" : "test", "\_type" : "type1" } }  
{ "field1" : "value2" }

I have tried increasing the size of file in Bulk Import. I can successfully import Json File up to 160 MB. All the files above the size are not indexed and is ignored by elasticsearch withour giving an error.

How can I send the 1 GB big log data at once to elasticsearch. I cannot break the log file to small piece and send it to Elasticsearch, as it is created automatically by a program.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [November 7, 2017, 8:45am UTC](https://discuss.elastic.co/t/bulk-import-to-elasticsearch/106644/2 "2017-11-07T08:45:16Z")

</div>

How are you sending it to Elasticsearch?

---

<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:** [November 7, 2017, 8:53am UTC](https://discuss.elastic.co/t/bulk-import-to-elasticsearch/106644/3 "2017-11-07T08:53:00Z")

</div>

> I cannot break the log file to small piece and send it to Elasticsearch, as it is created automatically by a program.

You must break it into smaller pieces.

You can use Logstash for this, even a unix script can probably do it.

---

<div class="post-metadata">

**Author:** ![Biraj\_Dhungel](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@Biraj\_Dhungel](https://discuss.elastic.co/u/Biraj_Dhungel)\
**Post date:** [November 7, 2017, 9:03am UTC](https://discuss.elastic.co/t/bulk-import-to-elasticsearch/106644/4 "2017-11-07T09:03:24Z")

</div>

Thank you for a quick Reply. As I Early mentioned, the log file is written in a format for a Bulk import.  
{ "index" : { "\_index" : "test", "\_type" : "type1" } }  
{ "field1" : "value1" }  
{ "index" : { "\_index" : "test", "\_type" : "type1" } }  
{ "field1" : "value2" }

If I use Logstash it must ignore the every odd Lines `{ "index" : { "_index" : "test", "_type" : "type1" } }.`

As I am new to logstash, can I do it easily?

---

<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:** [November 7, 2017, 9:31am UTC](https://discuss.elastic.co/t/bulk-import-to-elasticsearch/106644/5 "2017-11-07T09:31:55Z")

</div>

I’d just split the file into sub files,  
A unix script will do that easily IMO

---

<div class="post-metadata">

**Author:** ![Biraj\_Dhungel](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@Biraj\_Dhungel](https://discuss.elastic.co/u/Biraj_Dhungel)\
**Post date:** [November 7, 2017, 9:35am UTC](https://discuss.elastic.co/t/bulk-import-to-elasticsearch/106644/6 "2017-11-07T09:35:14Z")

</div>

curl -XPOST 'elasticsearch:9200/\_bulk' -d @test.json

It works for small sized file but my file is more than 1 Gb. Now I am using Logstash and its working fine,

---

<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 5, 2017, 9:35am UTC](https://discuss.elastic.co/t/bulk-import-to-elasticsearch/106644/7 "2017-12-05T09:35:27Z")

</div>

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