Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Always use the index alias instead of the name
  • Loading branch information
mickeyn committed Nov 1, 2016
1 parent ba9cab4 commit 980458d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions lib/MetaCPAN/Script/Backpan.pm
Expand Up @@ -91,7 +91,7 @@ sub build_release_status_map {
my $scroll = $self->es->scroll_helper(
size => 500,
scroll => '5m',
index => 'cpan_v1',
index => $self->index->name,
type => 'release',
fields => [ 'author', 'archive', 'name' ],
body => $self->_get_release_query,
Expand Down Expand Up @@ -150,7 +150,7 @@ sub update_releases {
log_info {"update_releases"};

$self->_bulk->{release} ||= $self->es->bulk_helper(
index => 'cpan_v1',
index => $self->index->name,
type => 'release',
max_count => 250,
timeout => '5m',
Expand Down Expand Up @@ -193,7 +193,7 @@ sub update_files_author {
my $scroll = $self->es->scroll_helper(
size => 500,
scroll => '5m',
index => 'cpan_v1',
index => $self->index->name,
type => 'file',
fields => ['release'],
body => {
Expand All @@ -209,7 +209,7 @@ sub update_files_author {
);

$self->_bulk->{file} ||= $self->es->bulk_helper(
index => 'cpan_v1',
index => $self->index->name,
type => 'file',
max_count => 250,
timeout => '5m',
Expand Down
7 changes: 5 additions & 2 deletions t/server/controller/author.t
Expand Up @@ -26,8 +26,11 @@ test_psgi app, sub {
my $json = decode_json_ok($res);
ok( $json->{pauseid} eq 'MO', 'pauseid is MO' )
if ( $k eq '/author/MO' );
ok( ref $json->{cpan_v1}{mappings}{author} eq 'HASH', '_mapping' )
if ( $k eq '/author/_mapping' );

if ( $k eq '/author/_mapping' ) {
my ($index) = keys %{$json};
ok( ref $json->{$index}{mappings}{author} eq 'HASH', '_mapping' );
}
}

ok( my $res = $cb->( GET '/author/MO?callback=jsonp' ), 'GET jsonp' );
Expand Down

0 comments on commit 980458d

Please sign in to comment.