remove empty fields arrays from mapping, this is not ignored anymore by elasticsearch 1.*
This commit is contained in:
parent
ae02364e7c
commit
eaa9f83997
|
@ -234,6 +234,7 @@ class FOSElasticaExtension extends Extension
|
|||
$this->indexConfigs[$indexName]['config']['mappings'][$name]['_routing'] = $type['_routing'];
|
||||
}
|
||||
if (isset($type['mappings']) && !empty($type['mappings'])) {
|
||||
$this->cleanUpMapping($type['mappings']);
|
||||
$this->indexConfigs[$indexName]['config']['mappings'][$name]['properties'] = $type['mappings'];
|
||||
$typeName = sprintf('%s/%s', $indexName, $name);
|
||||
$this->typeFields[$typeName] = $type['mappings'];
|
||||
|
@ -570,4 +571,14 @@ class FOSElasticaExtension extends Extension
|
|||
|
||||
$container->setAlias('fos_elastica.manager', sprintf('fos_elastica.manager.%s', $defaultManagerService));
|
||||
}
|
||||
|
||||
protected function cleanUpMapping(&$mappings)
|
||||
{
|
||||
foreach ($mappings as &$fieldProperties)
|
||||
if (empty($fieldProperties['fields'])) {
|
||||
unset($fieldProperties['fields']);
|
||||
} else {
|
||||
$this->cleanUpMapping($fieldProperties['fields']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue