1<?php
2
3namespace Elastica\Processor;
4
5/**
6 * Elastica Append Processor.
7 *
8 * @author Federico Panini <fpanini@gmail.com>
9 *
10 * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/append-processor.html
11 */
12class AppendProcessor extends AbstractProcessor
13{
14    use Traits\FieldTrait;
15    use Traits\IgnoreFailureTrait;
16
17    /**
18     * @param string       $field field name
19     * @param array|string $value field values to append
20     */
21    public function __construct(string $field, $value)
22    {
23        $this->setField($field);
24        $this->setValue($value);
25    }
26
27    /**
28     * Set field value.
29     *
30     * @param array|string $value
31     *
32     * @return $this
33     */
34    public function setValue($value): self
35    {
36        return $this->setParam('value', $value);
37    }
38
39    /**
40     * Set allow_duplicates value.
41     *
42     * @return $this
43     */
44    public function setAllowDuplicates(bool $allowDuplicates): self
45    {
46        return $this->setParam('allow_duplicates', $allowDuplicates);
47    }
48}
49