API: UpdateRequest question

bulkRequest.add(new UpdateRequest(index, id).doc(asMap).upsert(asMap));

Can somebody please point me to an explanation on when to use ".doc()" and ".upsert()"?

My above example works, but java memory analyzer shows the bulkList payload(asMap) is being added to both doc & upsert list, which takes up double the RAM usage.

It's kind of confusing on exactly what parameter is required for index, upsert, update, etc.
Ideally, I want to have 1 call that can do all 3.
I have another call:
bulkRequest.add(new UpdateRequest(index, id).doc(json, XContentType.JSON).upsert(json, XContentType.JSON));

This one seems to do update fine.

Thanks.

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