Elasticlient
|
#include <bulk.h>
Public Member Functions | |
SameIndexBulkData (const std::string &indexName, std::size_t size=100) | |
virtual std::string | indexName () const override |
Return index name set during contruction. | |
bool | indexDocument (const std::string &docType, const std::string &id, const std::string &doc) |
bool | indexDocument (const std::string &docType, const std::string &id, const std::string &doc, bool validate) |
bool | createDocument (const std::string &docType, const std::string &id, const std::string &doc) |
bool | createDocument (const std::string &docType, const std::string &id, const std::string &doc, bool validate) |
bool | updateDocument (const std::string &docType, const std::string &id, const std::string &doc) |
bool | updateDocument (const std::string &docType, const std::string &id, const std::string &doc, bool validate) |
void | clear () |
Clear bulk (size() == 0 after this). | |
virtual bool | empty () const override |
Return true if bulk has no data inside. | |
virtual std::size_t | size () const override |
Return number of documents inside the bulk. | |
virtual std::string | body () const override |
Return elasticsearch bulk request data. | |
Data collector for the bulk operation. All bulk data must be determined to be send to same index. Class produces document body for elasticsearch /_bulk request.
|
explicit |
Create Bulk data collector with desired size. Size of the bulk is not limiting the client to insert more elements into bulk.
indexName | Name of the index all data will be send to. |
bool elasticlient::SameIndexBulkData::createDocument | ( | const std::string & | docType, |
const std::string & | id, | ||
const std::string & | doc | ||
) |
Add create document request to the bulk.
docType | document type (as specified in mapping). |
id | document ID, for auto-generated ID use empty string. |
doc | Json document to index. Must not contain newline char. |
bool elasticlient::SameIndexBulkData::createDocument | ( | const std::string & | docType, |
const std::string & | id, | ||
const std::string & | doc, | ||
bool | validate | ||
) |
Add create document request to the bulk.
docType | document type (as specified in mapping). |
id | document ID, for auto-generated ID use empty string. |
doc | Json document to index. Must not contain newline char. |
validate | checks whether string contains a newline. |
bool elasticlient::SameIndexBulkData::indexDocument | ( | const std::string & | docType, |
const std::string & | id, | ||
const std::string & | doc | ||
) |
Add index document request to the bulk.
docType | document type (as specified in mapping). |
id | document ID, for auto-generated ID use empty string. |
doc | Json document to index. Must not contain newline char. |
bool elasticlient::SameIndexBulkData::indexDocument | ( | const std::string & | docType, |
const std::string & | id, | ||
const std::string & | doc, | ||
bool | validate | ||
) |
Add index document request to the bulk.
docType | document type (as specified in mapping). |
id | document ID, for auto-generated ID use empty string. |
doc | Json document to index. Must not contain newline char. |
validate | checks whether string contains a newline. |
bool elasticlient::SameIndexBulkData::updateDocument | ( | const std::string & | docType, |
const std::string & | id, | ||
const std::string & | doc | ||
) |
Add update document request to the bulk.
docType | document type (as specified in mapping). |
id | document ID, for auto-generated ID use empty string. |
doc | Json document to index. Must not contain newline char. |
bool elasticlient::SameIndexBulkData::updateDocument | ( | const std::string & | docType, |
const std::string & | id, | ||
const std::string & | doc, | ||
bool | validate | ||
) |
Add update document request to the bulk.
docType | document type (as specified in mapping). |
id | document ID, for auto-generated ID use empty string. |
doc | Json document to index. Must not contain newline char. |
validate | checks whether string contains a newline. |