@@ -386,11 +386,17 @@ void BulkBuilder::create(const std::string &index, const std::string &type, cons
386386 operations.push_back (fields);
387387}
388388
389- void BulkBuilder::update (const std::string &index, const std::string &type, const std::string &id, const Json::Object &fields) {
389+ void BulkBuilder::update (const std::string &index, const std::string &type, const std::string &id, const Json::Object &body) {
390+ createCommand (" update" , index, type, id);
391+ operations.push_back (body);
392+ }
393+
394+ void BulkBuilder::update_doc (const std::string &index, const std::string &type, const std::string &id, const Json::Object &fields, bool upsert) {
390395 createCommand (" update" , index, type, id);
391396
392397 Json::Object updateFields;
393398 updateFields.addMemberByKey (" doc" , fields);
399+ updateFields.addMemberByKey (" doc_as_upsert" , upsert);
394400
395401 operations.push_back (updateFields);
396402}
@@ -399,16 +405,6 @@ void BulkBuilder::del(const std::string &index, const std::string &type, const s
399405 createCommand (" delete" , index, type, id);
400406}
401407
402- void BulkBuilder::upsert (const std::string &index, const std::string &type, const std::string &id, const Json::Object &fields) {
403- createCommand (" update" , index, type, id);
404-
405- Json::Object updateFields;
406- updateFields.addMemberByKey (" doc" , fields);
407- updateFields.addMemberByKey (" doc_as_upsert" , true );
408-
409- operations.push_back (updateFields);
410- }
411-
412408std::string BulkBuilder::str () {
413409 std::stringstream json;
414410
0 commit comments