# Bulk insert to Elastic from Logstash "bulk\_path"

**URL:** <https://discuss.elastic.co/t/bulk-insert-to-elastic-from-logstash-bulk-path/196352>\
**Category:** Logstash\
**Created:** [August 22, 2019, 2:47pm UTC](https://discuss.elastic.co/t/bulk-insert-to-elastic-from-logstash-bulk-path/196352 "2019-08-22T14:47:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![baselai](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@baselai](https://discuss.elastic.co/u/baselai)\
**Post date:** [August 22, 2019, 2:47pm UTC](https://discuss.elastic.co/t/bulk-insert-to-elastic-from-logstash-bulk-path/196352/1 "2019-08-22T14:47:04Z")

</div>

I have a huge csv file, like 500k rows, that I'm processing and want to push to elastic

This output:

```auto
elasticsearch {
        index => "%{pipelineId}"
        hosts => ["${domain:port}/"]
    }

```

outputs one document at a time! it takes like 11-14 mins.  
Here is what I'm doing to do bulk but it takes the same time as above!

```auto
elasticsearch {
        index => "%{pipelineId}"
        hosts => ["${domain:port}/"]
        bulk_path => "${domain:port}/_bulk"
    }

```

any ideas why?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [August 22, 2019, 6:12pm UTC](https://discuss.elastic.co/t/bulk-insert-to-elastic-from-logstash-bulk-path/196352/2 "2019-08-22T18:12:55Z")

</div>

> [@baselai](#):
>
> outputs one document at a time!

What makes you think the elasticsearch output is sending one document at a time?

---

<div class="post-metadata">

**Author:** ![baselai](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@baselai](https://discuss.elastic.co/u/baselai)\
**Post date:** [August 22, 2019, 6:17pm UTC](https://discuss.elastic.co/t/bulk-insert-to-elastic-from-logstash-bulk-path/196352/3 "2019-08-22T18:17:19Z")

</div>

@Badger I'm outputting on the terminal every time it sends to elasticsearch

```auto
    stdout { codec => rubydebug }
    file {
        path => "/usr/share/output/output.json"
        codec => "json_lines"
    }

```

and also the time, 11-13 mins for 500k json document pushed to ES

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [August 22, 2019, 6:45pm UTC](https://discuss.elastic.co/t/bulk-insert-to-elastic-from-logstash-bulk-path/196352/4 "2019-08-22T18:45:22Z")

</div>

The elasticsearch output uses the bulk API to load data. I haven't checked the code, but I would expect it to load each pipeline batch (by default 125 events) as a single API call.

It would not surprise me if rubydebug is your rate-limiting component. How long does it take if you remove the non-elasticsearch outputs.

---

<div class="post-metadata">

**Author:** ![baselai](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@baselai](https://discuss.elastic.co/u/baselai)\
**Post date:** [August 22, 2019, 6:57pm UTC](https://discuss.elastic.co/t/bulk-insert-to-elastic-from-logstash-bulk-path/196352/5 "2019-08-22T18:57:14Z")

</div>

> [@Badger](#):
>
> It would not surprise me if rubydebug is your rate-limiting component. How long does it take if you remove the non-elasticsearch outputs.

I just ran it, with 854430 docs pushed to ES, it took 9 minutes.

---

<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:** [August 22, 2019, 7:42pm UTC](https://discuss.elastic.co/t/bulk-insert-to-elastic-from-logstash-bulk-path/196352/6 "2019-08-22T19:42:12Z")

</div>

What is the size of your documents? What is the size and specification of your Elasticsearch cluster?

---

<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:** [September 19, 2019, 7:42pm UTC](https://discuss.elastic.co/t/bulk-insert-to-elastic-from-logstash-bulk-path/196352/7 "2019-09-19T19:42:19Z")

</div>

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