1<?php
2
3namespace Elastica\Processor;
4
5/**
6 * Elastica Attachment Processor.
7 *
8 * @author Federico Panini <fpanini@gmail.com>
9 *
10 * @see https://www.elastic.co/guide/en/elasticsearch/plugins/current/ingest-attachment.html
11 */
12class AttachmentProcessor extends AbstractProcessor
13{
14    use Traits\FieldTrait;
15    use Traits\IgnoreMissingTrait;
16    use Traits\TargetFieldTrait;
17
18    public const DEFAULT_TARGET_FIELD_VALUE = 'attachment';
19    public const DEFAULT_INDEXED_CHARS_VALUE = 100000;
20    public const DEFAULT_IGNORE_MISSING_VALUE = false;
21
22    public function __construct(string $field)
23    {
24        $this->setField($field);
25    }
26
27    /**
28     * Set indexed_chars. Default 100000.
29     *
30     * @return $this
31     */
32    public function setIndexedChars(int $indexedChars): self
33    {
34        return $this->setParam('indexed_chars', $indexedChars);
35    }
36
37    /**
38     * Set properties. Default all properties. Can be content, title, name, author, keywords, date, content_type, content_length, language.
39     *
40     * @return $this
41     */
42    public function setProperties(array $properties): self
43    {
44        return $this->setParam('properties', $properties);
45    }
46}
47