Elasticsearch _bulk insert node js axios

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

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.

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