App-ElasticSearch-Utilities
    
    
  
  
  
view release on metacpan or search on metacpan
lib/App/ElasticSearch/Utilities/Aggregations.pm view on Meta::CPAN
    params => sub {
        return unless $_[0] > 0;
        return { interval => $_[0] };
    },
    type      => 'bucket',
    composite => 1,
};
$Aggregations{date_histogram} = {
    params    => sub { { calendar_interval => $_[0] || '1h' } },
    type      => 'bucket',
    composite => 1,
};
$Aggregations{geohash_grid} = {
    params    => sub { $_[0] =~ /^\d+$/ ? { precision => $_[0] } : {} },
    type      => 'bucket',
    composite => 1,
};
lib/App/ElasticSearch/Utilities/Aggregations.pm view on Meta::CPAN
        "histogram.field_name": {
            "histogram": {
                "field": "field_name",
                "interval": 10
            }
        }
    }
=item B<date_histogram>
Creates a histogram for date fields.  Positional parameter is the calendar_interval.
    date_histogram:field_name:1h
Results in:
    {
        "histogram.field_name": {
            "histogram": {
                "field": "field_name",
                "calendar_interval": "1h"
            }
        }
    }
=item B<geohash_grid>
Creates a geohash grid bucket aggregation.  Positional parameter is the precision.
    geohash_grid:field_name:6
( run in 0.458 second using v1.01-cache-2.11-cpan-5dc5da66d9d )