Data-AnyXfer
view release on metacpan or search on metacpan
lib/Data/AnyXfer/Elastic/Index.pm view on Meta::CPAN
isa => Str,
required => 1,
);
=head2 C<index_type>
Sets the type of document.
=cut
has index_type => (
is => 'ro',
isa => Str,
required => 1,
);
=head2 C<is_inject_index_and_type>
This overrides the attribute in L<Data::AnyXfer::Elastic>. It forces
any method called to be injected with the index name and type - fetched from the
attributes C<index_name> and C<index_type>.
=cut
has '+is_inject_index_and_type' => ( default => 1, );
=head1 METHODS
Methods are imported from:
See: L<Search::Elasticsearch::Client::Direct>
=cut
sub BUILD {
my $self = shift;
$self->_wrap_methods( $self->elasticsearch, \@METHODS );
return $self;
}
=head1 IMPLEMENTS METHODS
=head2 suggest
$index->suggest( body => {} );
This method was removed in later versions of Elasticsearch,
so we provide a replacement for compatibility.
=cut
sub suggest {
my ( $self, %args ) = @_;
# perform the suggestions search as part of a
# normal search now that the suggest endpoint has been removed
my $results = $self->search( #
%args, body => { suggest => $args{body} }
);
return $results->{suggest};
}
use namespace::autoclean;
1;
=head1 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.
=cut
( run in 2.334 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )