in t/Client_7_0/32_bulk_flush.t [82:111]
sub test_flush {
#===================================
my $title = shift;
my $params = shift;
my $b = $es->bulk_helper(
%$params,
index => 'test'
);
my @seq = @_;
$es->indices->delete( index => 'test', ignore => 404 );
$es->indices->create( index => 'test' );
$es->cluster->health( wait_for_status => 'yellow' );
for my $i ( 10 .. 19 ) {
# sleep on 12 or 18 if max_time specified
if ( $params->{max_time} && ( $i == 12 || $i == 18 ) ) {
$b->_last_flush( time - $params->{max_time} - 1 );
}
$b->index( { id => $i, source => {} } );
is $b->_buffer_count, shift @seq, "$title - " . ( $i - 9 );
}
$b->flush;
is $b->_buffer_count, 0, "$title - final flush";
$es->indices->refresh;
is $es->count->{count}, 10, "$title - all docs indexed";
}