@@ -386,11 +386,17 @@ void BulkBuilder::create(const std::string &index, const std::string &type, cons
386
386
operations.push_back (fields);
387
387
}
388
388
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) {
390
395
createCommand (" update" , index , type, id);
391
396
392
397
Json::Object updateFields;
393
398
updateFields.addMemberByKey (" doc" , fields);
399
+ updateFields.addMemberByKey (" doc_as_upsert" , upsert);
394
400
395
401
operations.push_back (updateFields);
396
402
}
@@ -399,16 +405,6 @@ void BulkBuilder::del(const std::string &index, const std::string &type, const s
399
405
createCommand (" delete" , index , type, id);
400
406
}
401
407
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
-
412
408
std::string BulkBuilder::str () {
413
409
std::stringstream json;
414
410
0 commit comments