From 0403168da3d2ed02b10b9f48cf20f6b5022ef971 Mon Sep 17 00:00:00 2001 From: Graham Knop Date: Wed, 30 Oct 2024 01:28:42 +0100 Subject: [PATCH] improve settings for index creation --- lib/MetaCPAN/ESConfig.pm | 5 ----- lib/MetaCPAN/Script/Mapping.pm | 11 ++++++++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/MetaCPAN/ESConfig.pm b/lib/MetaCPAN/ESConfig.pm index bfb20178e..d06a53998 100644 --- a/lib/MetaCPAN/ESConfig.pm +++ b/lib/MetaCPAN/ESConfig.pm @@ -126,11 +126,6 @@ const my %config => merge( use Moo; } -has indexes => ( - is => 'ro', - required => 1, -); - has all_indexes => ( is => 'lazy', default => sub ($self) { diff --git a/lib/MetaCPAN/Script/Mapping.pm b/lib/MetaCPAN/Script/Mapping.pm index 895f61ee7..04d9225a5 100644 --- a/lib/MetaCPAN/Script/Mapping.pm +++ b/lib/MetaCPAN/Script/Mapping.pm @@ -336,7 +336,12 @@ sub create_index { # create the new index with the copied settings log_info {"Creating index: $dst_idx"}; - $self->es->indices->create( index => $dst_idx, body => $index_settings ); + $self->es->indices->create( + index => $dst_idx, + body => { + settings => $index_settings, + }, + ); # override with new type mapping if ( $self->patch_mapping ) { @@ -526,7 +531,7 @@ sub _build_index_config { }; } - return $mappings; + return $indices; } sub deploy_mapping { @@ -791,7 +796,7 @@ sub indices_valid { && $config_indices->{$idx}->{'mappings'}; my $deploy_mappings = $deploy_indices->{$idx} && $deploy_indices->{$idx}->{'mappings'}; - if ( !$deploy ) { + if ( !$deploy_mappings ) { log_error {"Missing index: $idx"}; $valid = 0; next;