1212 * */
1313
1414use TYPO3 \Flow \Annotations as Flow ;
15+ use TYPO3 \Flow \Utility \Arrays ;
1516
1617/**
1718 * Reflects a Mapping of Elasticsearch
@@ -34,6 +35,15 @@ class Mapping {
3435 */
3536 protected $ dynamicTemplates = array ();
3637
38+ /**
39+ * This is the full / raw ElasticSearch mapping which is merged with the properties and dynamicTemplates.
40+ *
41+ * It can be used to specify arbitrary ElasticSearch mapping options, like f.e. configuring the _all field.
42+ *
43+ * @var array
44+ */
45+ protected $ fullMapping = array ();
46+
3747 /**
3848 * @param \Flowpack\ElasticSearch\Domain\Model\AbstractType $type
3949 */
@@ -82,10 +92,10 @@ public function getType() {
8292 * @return array
8393 */
8494 public function asArray () {
85- return array ($ this ->type ->getName () => array (
95+ return array ($ this ->type ->getName () => Arrays:: arrayMergeRecursiveOverrule ( array (
8696 'dynamic_templates ' => $ this ->getDynamicTemplates (),
8797 'properties ' => $ this ->getProperties ()
88- ));
98+ ), $ this -> fullMapping ) );
8999 }
90100
91101 /**
@@ -116,4 +126,23 @@ public function addDynamicTemplate($dynamicTemplateName, array $mappingConfigura
116126 $ dynamicTemplateName => $ mappingConfiguration
117127 );
118128 }
129+
130+ /**
131+ * This is the full / raw ElasticSearch mapping which is merged with the properties and dynamicTemplates.
132+ *
133+ * It can be used to specify arbitrary ElasticSearch mapping options, like f.e. configuring the _all field.
134+ *
135+ * @param array $fullMapping
136+ */
137+ public function setFullMapping (array $ fullMapping ) {
138+ $ this ->fullMapping = $ fullMapping ;
139+ }
140+
141+ /**
142+ * see {@link setFullMapping} for documentation
143+ * @return array
144+ */
145+ public function getFullMapping () {
146+ return $ this ->fullMapping ;
147+ }
119148}
0 commit comments