# Elasticsearch \_bulk insert node js axios

**URL:** <https://discuss.elastic.co/t/elasticsearch-bulk-insert-node-js-axios/220099>\
**Category:** Elasticsearch\
**Created:** [February 20, 2020, 6:51am UTC](https://discuss.elastic.co/t/elasticsearch-bulk-insert-node-js-axios/220099 "2020-02-20T06:51:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chase2981](https://avatars.discourse-cdn.com/v4/letter/c/a3d4f5/32.png) [@chase2981](https://discuss.elastic.co/u/chase2981)\
**Post date:** [February 20, 2020, 6:51am UTC](https://discuss.elastic.co/t/elasticsearch-bulk-insert-node-js-axios/220099/1 "2020-02-20T06:51:16Z")

</div>

```
axios.post(`http://ec2-99-999-99-999.us-west-2.compute.amazonaws.com:9200/_bulk`,
  `{ "update" : {"_id" : "1", "_index" : "test"} }\n{ "doc" : {"field2" : "value2"} }\n`, {
    headers: {
      'Content-type': 'application/json'
    },
  auth: { username: 'user', password: 'pass' }
}
).then((result) => {
  console.log('result _bulk', result.data.items);
}).catch((err) => {
  console.log('err', err);
});

```

[https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html#docs-bulk-api-example](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html#docs-bulk-api-example)

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [February 20, 2020, 7:59am UTC](https://discuss.elastic.co/t/elasticsearch-bulk-insert-node-js-axios/220099/2 "2020-02-20T07:59:45Z")

</div>

Please take your time to properly write up your problem. Just copy pasting a code snippet is pretty useless if you do not explain what error you are received, what outcome you would have been expected, what elasticsearchversion you are testing against, how the same requests looks via curl or the dev-tools.

Creating a proper issue/writeup requires some time, but will increase your chances of getting a reply **a lot**.

---

<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 19, 2020, 8:10am UTC](https://discuss.elastic.co/t/elasticsearch-bulk-insert-node-js-axios/220099/3 "2020-03-19T08:10:43Z")

</div>

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