I'm building a data backfill script for random dataloss in elasticSearch. I only want to add missing documents in an index from the backup; new versions may already exist and I don't want to lose any updates.
The elasticSearch index api allows me to specify the OpType to not update records:
https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index
e.g. [opType=create]
and I'm trying to use the bulk api to make it more efficient: https://www.elastic.co/guide/en/elasticsearch/reference/6.6/docs-bulk.html
What I can't figure out is where to put the 'opType' in the bulk api.
is it in the metadata field so it looks like the following?
{ 'index': { '_index': indexName, '_type': 'data', '_id': <my Id>, 'opType': 'create' } }
{data for item}
or do I put it somewhere else?