App-ElasticSearch-Utilities
view release on metacpan or search on metacpan
lib/App/ElasticSearch/Utilities.pm view on Meta::CPAN
our %_GLOBALS = ();
my %DEF = ();
my %PATTERN_REGEX = (
'*' => qr/.*/,
ANY => qr/.*/,
DATE => qr/
(?<datestr>
(?<year>\d{4}) # Extract 4 digits for the year
(?:(?<datesep>[\-.]))? # Optionally, look for . - as a separator
(?<month>\d{2}) # Two digits for the month
\g{datesep} # Whatever the date separator was in the previous match
(?<day>\d{2}) # Two digits for the day
(?![a-zA-Z0-9]) # Zero width negative look ahead, not alphanumeric
)
/x,
);
my $PATTERN;
{
## no critic (ProhibitNoWarnings)
no warnings;
lib/App/ElasticSearch/Utilities/Metrics.pm view on Meta::CPAN
# Skip unallocated shards
next unless $shard->{id};
# Skip unless this shard is allocated to this shard
next unless $shard->{id} eq $id;
# Skip "Special" Indexes
next if $shard->{index} =~ /^\./;
# Figure out the Index Basename
my $index = $shard->{index} =~ s/[-_]\d{4}([.-])\d{2}\g{1}\d{2}(?:[-_.]\d+)?$//r;
next unless $index;
$index =~ s/[^a-zA-Z0-9]+/_/g;
my $type = $shard->{prirep} eq 'p' ? 'primary' : 'replica';
# Initialize
$results{$index} ||= { map { $_ => 0 } qw( docs bytes primary replica ) };
$results{$index}->{state} ||= {};
$results{$index}->{state}{$shard->{state}} ||= 0;
$results{$index}->{state}{$shard->{state}}++;
( run in 0.328 second using v1.01-cache-2.11-cpan-87723dcf8b7 )