ElasticSearchX::Model::Bulk
version 0.1.7
my $bulk = $model->bulk( size => 10 ); my $document = $model->index('default')->type('tweet')->new_document({ message => 'Hello there!', date => DateTime->now, }); $bulk->put( $document ); $bulk->commit;
This class is a wrapper around "bulk()" in ElasticSearch which adds some convenience. By specifiying a "size" you set the maximum number of documents that are processed in one request. You can either "put" or "delete" documents. Once the $bulk object is out of scope, it will automatically commit its "stash". Call "clear" if before if you don't want that to happen.
$bulk
The maximum number of documents that are processed in one request. Once the stash hits that number, a bulk request will be issued automatically and the stash will be cleared.
The stash includes the documents that will be processed at the next commit. A commit is either automatically issued if the size of the stash is greater then "size", if the $bulk object gets out of scope or if you call "commit" explicitly.
The ElasticSearch object.
Put a document. Accepts a document object (see "new_document" in ElasticSearchX::Model::Document::Set) or a HashRef for better performance.
Delete a document. You can either pass a document object or a HashRef that consists of index, type and id.
index
type
id
Commits the documents in the stash to ElasticSearch.
Clears the stash.
Returns the number of documents in the stash.
Moritz Onken
This software is Copyright (c) 2013 by Moritz Onken.
This is free software, licensed under:
The (three-clause) BSD License
To install ElasticSearchX::Model, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ElasticSearchX::Model
CPAN shell
perl -MCPAN -e shell install ElasticSearchX::Model
For more information on module installation, please visit the detailed CPAN module installation guide.