Skip to content

Commit

Permalink
https://github.com/ongr-io/ElasticsearchBundle/issues/920
Browse files Browse the repository at this point in the history
  • Loading branch information
petrmalina authored and saimaz committed Feb 20, 2020
1 parent 9df2ed7 commit 769cd3d
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions DependencyInjection/Compiler/MappingPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 769cd3d

Please sign in to comment.