Data-AnyXfer
view release on metacpan or search on metacpan
lib/Data/AnyXfer/Elastic/Role/Project.pm view on Meta::CPAN
( $search_args{body} ||= {} )->{query} ||= { match_all => {} };
$search_args{size} //= 1000;
if ( my $point = delete $search_args{point} ) {
my $points_geo_shape = [
{ geo_shape => {
polygon => {
shape => {
type => 'point',
coordinates => $point
},
relation => 'intersects'
}
}
}
];
$search_args{body}{query}{bool}{must} = $points_geo_shape;
# Build the filters
my @filters;
push @filters, $search_args{body}->{filter} || ();
if (@filters) {
$search_args{body}{query}{bool}{filter} = \@filters;
}
}
# run search and return
return $self->_es_simple_search(%search_args);
}
=head1 Scrolling Searches
Passing B<_es_simple_search> - or any function that extends its functionality
- a C<scroll_size> returns a L<Data::AnyXfer::Elastic::ScrollHelper>
instead of a result. This can then be used for reading batched results from
ES.
=over
=item C<scroll_size>
The number of results to return for each batch from each node in the ES
cluster. The total size of the batch returned is C<scroll_size * es_nodes>.
If this is set then scrolling will be used, an instance of
L<Data::AnyXfer::Elastic::ScrollHelper> will be returned instead of
the normal results.
=item C<search_type>
Efficient scrolling can be set by setting the C<search_type> to C<scan>,
saving on the innefficient sorting phase.
=item C<scroll>
Set the duration to keep the results alive, for processing before the next set
of results is fetched. Default is C<5m>.
=back
=head1 ENVIRONMENT
=head2 ES_DEBUG
$ENV{ES_DEBUG} = 1;
Set debugging printing of ES calls.
=cut
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 1.146 second using v1.01-cache-2.11-cpan-39bf76dae61 )