Skip to content

Commit 996e865

Browse files
committed
Ability to set fielddata
1 parent a7997db commit 996e865

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Mapping/Settings/Mapping/Field.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@ class Field
2121
*/
2222
private $analyzer;
2323

24+
/**
25+
* @var bool|null
26+
*/
27+
private $fieldData;
28+
2429

2530
public function __construct(
2631
string $name,
2732
string $type = \Spameri\Elastic\Model\ValidateMapping\AllowedValues::TYPE_KEYWORD,
28-
?\Spameri\ElasticQuery\Mapping\AnalyzerInterface $analyzer = NULL
33+
?\Spameri\ElasticQuery\Mapping\AnalyzerInterface $analyzer = NULL,
34+
?bool $fieldData = NULL
2935
)
3036
{
3137
$this->name = $name;
@@ -36,6 +42,7 @@ public function __construct(
3642
}
3743
$this->type = $type;
3844
$this->analyzer = $analyzer;
45+
$this->fieldData = $fieldData;
3946
}
4047

4148

@@ -57,6 +64,10 @@ public function toArray(): array
5764
$array[$this->name]['analyzer'] = $this->analyzer->name();
5865
}
5966

67+
if ($this->fieldData !== NULL) {
68+
$array[$this->name]['fielddata'] = $this->fieldData;
69+
}
70+
6071
return $array;
6172
}
6273

0 commit comments

Comments
 (0)