From 769cd3d99034a38a5c21a477e7562d27b20313d9 Mon Sep 17 00:00:00 2001 From: Petr Malina Date: Thu, 20 Feb 2020 12:59:57 +0100 Subject: [PATCH] https://github.com/ongr-io/ElasticsearchBundle/issues/920 --- DependencyInjection/Compiler/MappingPass.php | 25 +++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) 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,