NAME
Data::AnyXfer::Elastic::Role::IndexInfo - Role representing Elasticsearch information
SYNOPSIS
if ( $object->does(
'Data::AnyXfer::Elastic::Role::IndexInfo') ) {
my $index = $object->get_index;
my $results =
$index->search( query => { match_all => {} } );
}
DESCRIPTION
This role is used by Data::AnyXfer::Elastic to retrieve or supply Elasticsearch indexing / storage information.
This basically acts as connection information. Any object satisfying the interface criteria may consume and implement this role.
SEE ALSO
REQUIRED METHODS
index
The name of the Elasticsearch index for the package / namespace.
If you don't know what a type is, see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/_basic_concepts.html#_index for more information.
type
The primary document type for the package / namespace.
If you don't know what an index is, see http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/_basic_concepts.html#_type for more information.
mappings
The mappings HASH
ref for all types containing in the index. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html#mappings
settings
The settings HASH
ref for any Elasticsearch index settings. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html#create-index-settings
warmers
The warmers map (HASH
ref), for the index. See http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-create-index.html#warmers
alias
The primary alias used for the project. This will always at least point to the "index".
See "aliases".
silo
The Data::AnyXfer::Elastic silo the data should be held in and retrieved from.
aliases
The full aliases map (HASH
ref) for the Elasticsearch create_index
call.
You do not need to define the mapping for "alias" unless you have special requirements. By default, this will be alised to the index if this object is used to index any new data.
PROVIDED ATTRIBUTES
api_version
if ($object->api_version =~ /^6/) {
# do something for elasticsearch 6
}
Returns the Search::Elasticsearch client API version. This is useful for changing behaviour for different versions of Elasticsearch or API changes.
PROVIDED METHODS
get_index
my $index = $object->get_index;
# use it...
Returns a basic instance of Data::AnyXfer::Elastic::Index using the objects own information, to use for reads only! (the index handle is created on the primary alias, found out through the interface).
Optionally takes a named argument direct
, which when set causes the index object to look directly at the generated index name, instead of the alias. (This will not do what you want if you use aliasing of any kind!)
get_indices
my $indices = $object->get_indices;
# use it...
Returns a basic instance of Data::AnyXfer::Elastic::Indices using the objects own information.
new_anon_project
my $project = $object->new_anon_project;
Returns an anonymous project consumer which uses this instance to satisfy its index_info
requirement.
See Data::AnyXfer::Elastic:Role::Project.
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.