Skip to content

Instantly share code, notes, and snippets.

@monken
Created March 19, 2011 18:27
Show Gist options
  • Select an option

  • Save monken/877687 to your computer and use it in GitHub Desktop.

Select an option

Save monken/877687 to your computer and use it in GitHub Desktop.
#!perl
use Test::More;
use strict;
use warnings;
our $cv;
our $es;
my $r;
$cv->begin;
$es->delete( index => 'es_test_1', type => 'type_1', id => 2 )->(
sub {
my ( $res, $error ) = @_;
isa_ok( $error, 'ElasticSearch::Error::Missing' );
$cv->end;
} );
$cv->begin;
$es->delete( index => 'es_test_1',
type => 'type_1',
id => 2,
ignore_missing => 1
)->(
sub {
my ( $res, $error ) = @_;
ok( $res, 'body exists' );
ok( !$error, 'no error' );
$cv->end;
} );
$cv->begin;
$es->delete( index => 'es_test_1',
type => 'type_1',
id => 1,
version => 1
)->(
sub {
my ( $res, $error ) = @_;
isa_ok( $error, 'ElasticSearch::Error::Conflict' );
$cv->end;
} );
$cv->begin;
ok $es->delete( index => 'es_test_1',
type => 'type_1',
id => 1,
version => 3,
refresh => 1,
replication => 'async',
consistency => 'all'
)->(
sub {
my ( $res, $error ) = @_;
ok( $res->{ok}, ' - version delete with options' );
$cv->end;
} );
1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment