diff --git a/DependencyInjection/Compiler/MappingPass.php b/DependencyInjection/Compiler/MappingPass.php index dc739659..818f78ca 100644 --- a/DependencyInjection/Compiler/MappingPass.php +++ b/DependencyInjection/Compiler/MappingPass.php @@ -75,14 +75,23 @@ private function handleDirectoryMapping(ContainerBuilder $container, string $dir $indexMetadata = $parser->getIndexMetadata($class); if (!empty($indexMetadata)) { - $indexMetadata['settings'] = array_filter(array_merge_recursive( - $indexMetadata['settings'] ?? [], - [ - 'number_of_replicas' => $document->numberOfReplicas, - 'number_of_shards' => $document->numberOfShards, - ], - $indexesOverride[$namespace]['settings'] ?? [] - )); + $indexMetadata['settings'] = array_filter( + array_replace_recursive( + $indexMetadata['settings'] ?? [], + [ + 'number_of_replicas' => $document->numberOfReplicas, + 'number_of_shards' => $document->numberOfShards, + ], + $indexesOverride[$namespace]['settings'] ?? [] + ), + function ($value) { + if (0 === $value) { + return true; + } + + return (bool)$value; + } + ); $indexSettings = new Definition( IndexSettings::class,