From 1402bdc9e63911510e093d22deb7b8290856719c Mon Sep 17 00:00:00 2001 From: Lea Haensenberger Date: Thu, 13 Feb 2014 09:11:05 +0100 Subject: [PATCH] Keep all special mapping fields for types when resetting a single type. Field list is according to the current documentation of elasticsearch 0.90 --- Resetter.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Resetter.php b/Resetter.php index 26a6bb5..d0f3014 100644 --- a/Resetter.php +++ b/Resetter.php @@ -74,12 +74,11 @@ class Resetter { $mapping = Mapping::create($indexConfig['properties']); - if (isset($indexConfig['_parent'])) { - $mapping->setParam('_parent', array('type' => $indexConfig['_parent']['type'])); - } - - if (isset($indexConfig['dynamic_templates'])) { - $mapping->setParam('dynamic_templates', $indexConfig['dynamic_templates']); + $mappingSpecialFields = array('_uid', '_id', '_source', '_all', '_analyzer', '_boost', '_parent', '_routing', '_index', '_size', '_timestamp', '_ttl'); + foreach ($mappingSpecialFields as $specialField) { + if (isset($indexConfig[$specialField])) { + $mapping->setParam($specialField, $indexConfig[$specialField]); + } } return $mapping;