1<?php
2
3namespace Elastica\Processor;
4
5/**
6 * Elastica Convert Processor.
7 *
8 * @author Federico Panini <fpanini@gmail.com>
9 *
10 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/convert-processor.html
11 */
12class ConvertProcessor extends AbstractProcessor
13{
14    use Traits\FieldTrait;
15    use Traits\IgnoreFailureTrait;
16    use Traits\IgnoreMissingTrait;
17    use Traits\TargetFieldTrait;
18
19    public const DEFAULT_TARGET_FIELD_VALUE = 'field';
20    public const DEFAULT_IGNORE_MISSING_VALUE = false;
21
22    public function __construct(string $field, string $type)
23    {
24        $this->setField($field);
25        $this->setType($type);
26    }
27
28    /**
29     * Set field value.
30     *
31     * @return $this
32     */
33    public function setType(string $type): self
34    {
35        return $this->setParam('type', $type);
36    }
37}
38