_bulk API: a field can't be removed unless deleting the document first and then upsert

Hi all,

Here is the scenario:

  1. I first populate the data record in Elasticsearch using _bulk API:
  • here is temp.json look like:
    { update : {"_id" : "Tra.1111" }}
    { doc : {"field1":"Test 1", "field2" : "Test 2" }, doc_as_upsert : true }

  • I then load it using _bulk api:
    curl -s -XPOST http://localhost:9200/thong_test/test/_bulk --data-binary
    @temp.json

  1. I then want to remove data in field2, but changing temp.json as below
    still leave field2 behind:

{ update : {"_id" : "Tra.1111" }}
{ doc : {"field1":"Test 1", }, doc_as_upsert : true }

If I delete it first, then it will work:

{ delete: {"_id" : "Tra.1111" }}
{ update : {"_id" : "Tra.1111" }}
{ doc : {"field1":"Test 1", "field2" : "Test 2" }, doc_as_upsert : true }

However, is there a better to remove a field in _bulk without delete and
insert the document?

Thanks so much for your help!

Thong Bui

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/6e2640e0-2ad9-45fe-8d2f-9501388f5d05%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.