Bulk indexing errors out (only 3 document)

(Jason Smith) #1

New to ELK stack. Trying to explore bulk indexing. I tried this command from Kibana.

I get Validation Failed error. I didn't make this up. I got it from elastick.co site for practice.
"error": {
"root_cause": [
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: index is missing;2: type is missing;"
"type": "action_request_validation_exception",
"reason": "Validation Failed: 1: index is missing;2: type is missing;"
"status": 400
POST _bulk
{"account_number":1,"balance":39225,"firstname":"Amber","lastname":"Duke","age":32,"gender":"M","address":"880 Holmes Lane","employer":"Pyrami","email":"amberduke@pyrami.com","city":"Brogan","state":"IL"}
{"account_number":6,"balance":5686,"firstname":"Hattie","lastname":"Bond","age":36,"gender":"M","address":"671 Bristol Street","employer":"Netagy","email":"hattiebond@netagy.com","city":"Dante","state":"TN"}

(Chris Roberson) #2

Hi @jason_smith,

Please refer to the official documentation for the bulk api. It outlines how to properly structure the request. By looking at your query, it seems like:


should be something like

{ "index" : { "_index" : "test", "_type" : "_doc", "_id" : "1" } }

(Jason Smith) #3

This data was provided by elastic.co at


I thought it should be correct since it is from elastic.co

thank you

(Chris Roberson) #4

Note the endpoint used in the example: POST localhost:9200/bank/account/_bulk. In your code, your endpoint is POST _bulk. If you specify the index and type in the url, then you don't need it in the query.


(Jason Smith) #5

I couldn't run this file from curl. I don't how.
So I took few documents from the JSON file and ran it from Kibana without using curl.

(kulkarni) #6

I used the same example mentioned in :https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html

POST _bulk
{ "index" : { "_index" : "test", "_type" : "_doc", "_id" : "1" } }
{ "field1" : "value1" }
{ "delete" : { "_index" : "test", "_type" : "_doc", "_id" : "2" } }
{ "create" : { "_index" : "test", "_type" : "_doc", "_id" : "3" } }
{ "field1" : "value3" }
{ "update" : {"_id" : "1", "_type" : "_doc", "_index" : "test"} }
{ "doc" : {"field2" : "value2"} }

This query worked for me on 6.2.2

(Chris Roberson) #7


In your example code listed, change

POST _bulk


POST <index_name>/<type_name>/_bulk

And replace <index_name> with the name of the index you want these documents to live and replace <type_name> with the name of the type for these documents (if you don't know what this should be, I'd recommend just using doc)

(Jason Smith) #8

Worked like a charm Chris!!!!!
Thank you mate.

(system) #9

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