NAME
Data::AnyXfer::Elastic::Role::CreateIndex - A Role for Elasticsearch Index construction
SYNOPSIS
package Parent;
use Moo;
use MooX::Types::MooseLike::Base qw(:all);
with 'Data::AnyXfer::Elastic::Role::CreateIndex';
1;
DESCRIPTION
This role provides a method for creating Elasticsearch Index.
METHODS
create_index()
$bool = Parent->create_index(
{
name => 'interiors_2013', # required
mappings => \%mappings, # optional
settings => \%settings, # optional
warmers => \%warmers, # optional
aliases => \%aliases, # optional
delete_previous => 1, # optional
}
);
This method wraps the Search::Elasticsearch::Client::Direct::Indices create
method. However it also provides an additional arguement delete_previous; which deletes the index, should it exist, prior to a new index creation. Essentially the index with alway be overridden.
Please note that the delete_previous arguement should be used with care. Supposing that an index contains multiple types - if the delete_previous flag is marked true then all types will destroyed when the index is deleted.
SEE ALSO
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html
COPYRIGHT
This software is copyright (c) 2019, Anthony Lucas.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.