Reputation: 87
I am using the bulk api to perform bulk operations on an index. Before implementing the bulk api I was able to auto create an index if it didn’t exist when I indexed a document. After switching to the bulk api it seems that the index operations in the bulk call do not behave this way. Is there something that needs to be added to a bulk call to regain this functionality or is it simply not possible with the bulk api. I couldn’t find anything in the elasticsearch documentation regarding this.
Upvotes: 0
Views: 636
Reputation: 3680
Each _bulk API call can create an index if you specified the index name. Here is an example:
POST _bulk
{ "index" : { "_index" : "test_index1", "_id" : "1" } }
{ "field1" : "value1" }
{ "index" : { "_index" : "test_index2", "_id" : "1" } }
{ "field1" : "value1" }
index => create a document if not exist, and update the document if exist.
Upvotes: 1