Skip to content

Commit 058715c

Browse files
committed
create mappings without types on ES 7
1 parent 281306e commit 058715c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

lib/MetaCPAN/Script/Mapping.pm

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,17 +174,18 @@ sub _build_index_config {
174174
my $doc = $docs->{$name};
175175
my $index = $doc->{index}
176176
or die "no index defined for $name documents";
177-
my $type = $doc->{type}
178-
or die "no type defined for $name documents";
179177
die "$index specified for multiple documents"
180178
if $indices->{$index};
181179
my $mapping = es_config->mapping( $name, $api_version );
182180
my $settings = es_config->index_settings( $name, $api_version );
181+
if ( $api_version le '6_0' ) {
182+
my $type = $doc->{type}
183+
or die "no type defined for $name documents";
184+
$mapping = { $type => $mapping };
185+
}
183186
$indices->{$index} = {
184187
settings => $settings,
185-
mappings => {
186-
$type => $mapping,
187-
},
188+
mappings => $mapping,
188189
};
189190
}
190191

0 commit comments

Comments
 (0)