Skip to content

Commit 9b06c0a

Browse files
committed
When generating mapping for index creation, do not explicitly specify "object" type
1 parent 7de6fde commit 9b06c0a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Annotation/Property.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,18 @@ final class Property implements DumperInterface
6161
* Dumps property fields as array for index mapping
6262
*
6363
* @param array $settings
64+
*
6465
* @return array
6566
*/
6667
public function dump(array $settings = [])
6768
{
68-
$result = array_merge((array) $this->options, ['type' => $this->type]);
69+
$result = (array) $this->options;
70+
71+
// Although it is completely valid syntax to explicitly define objects as such in the mapping definition, ES does not do that by default.
72+
// So, in order to ensure that the mapping for index creation would exactly match the mapping returned from the ES _mapping endpoint, we don't explicitly set 'object' data types
73+
if ($this->type !== 'object') {
74+
$result = array_merge($result, ['type' => $this->type]);
75+
}
6976

7077
if (isset($settings['language'])) {
7178
if (!isset($settings['indexAnalyzers'])) {

0 commit comments

Comments
 (0)