I have an index with existing documents. Some of them have a field missing. Is there a way to do a bulk update where only documents that don't have the field are updated, and documents that have the field are left untouched?
Simply put, given these two documents
{"_index":"events","_type":"users","_id":"123","_score":1,"_source":{"signup":"2016-09-01T02:21:08.034","purchase":"2016-09-01T02:39:31.923Z"}}
{"_index":"events","_type":"users","_id":"124","_score":1,"_source":{"signup":"2016-09-01T02:32:23.334"}}
If I send the following bulk request -
{"update":{"_index":"events","_type":"users","_id":"123"}}
{"doc": {"purchase": "2016-09-01T00:39:31.923Z"}}
{"update":{"_index":"events","_type":"users","_id":"124"}}
{"doc": {"purchase": "2016-09-01T02:43:11.416Z"}}
Then the purchase
field is added to document 124
, but document 123
is not updated
PS - I can't use scripting, its disabled on the cluster.
PPS - I'm using Elasticsearch version 1.5.2