@@ 12-109 (lines=98) @@ | ||
9 | * |
|
10 | * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/date-index-name-processor.html |
|
11 | */ |
|
12 | class DateIndexName extends AbstractProcessor |
|
13 | { |
|
14 | /** |
|
15 | * DateIndexName constructor. |
|
16 | * |
|
17 | * @param string $field |
|
18 | * @param string $dateRounding |
|
19 | */ |
|
20 | public function __construct(string $field, string $dateRounding) |
|
21 | { |
|
22 | $this->setField($field); |
|
23 | $this->setDateRounding($dateRounding); |
|
24 | } |
|
25 | ||
26 | /** |
|
27 | * Set field. |
|
28 | * |
|
29 | * @param string $field |
|
30 | * |
|
31 | * @return $this |
|
32 | */ |
|
33 | public function setField(string $field) |
|
34 | { |
|
35 | return $this->setParam('field', $field); |
|
36 | } |
|
37 | ||
38 | /** |
|
39 | * Set date_rounding. Valid values are: y (year), M (month), w (week), d (day), h (hour), m (minute) and s (second). |
|
40 | * |
|
41 | * @param string $dateRounding |
|
42 | * |
|
43 | * @return $this |
|
44 | */ |
|
45 | public function setDateRounding(string $dateRounding) |
|
46 | { |
|
47 | return $this->setParam('date_rounding', $dateRounding); |
|
48 | } |
|
49 | ||
50 | /** |
|
51 | * Set field formats. Joda pattern or one of the following formats ISO8601, UNIX, UNIX_MS, or TAI64N. |
|
52 | * |
|
53 | * @param array $formats |
|
54 | * |
|
55 | * @return $this |
|
56 | */ |
|
57 | public function setDateFormats(array $formats) |
|
58 | { |
|
59 | return $this->setParam('date_formats', $formats); |
|
60 | } |
|
61 | ||
62 | /** |
|
63 | * Set index_prefix_name. |
|
64 | * |
|
65 | * @param string $indexPrefixName |
|
66 | * |
|
67 | * @return $this |
|
68 | */ |
|
69 | public function setIndexNamePrefix(string $indexPrefixName) |
|
70 | { |
|
71 | return $this->setParam('index_name_prefix', $indexPrefixName); |
|
72 | } |
|
73 | ||
74 | /** |
|
75 | * Set format to be used when printing parsed date. An valid Joda pattern is expected here. Default yyyy-MM-dd. |
|
76 | * |
|
77 | * @param string $indexNameFormat |
|
78 | * |
|
79 | * @return $this |
|
80 | */ |
|
81 | public function setIndexNameFormat(string $indexNameFormat) |
|
82 | { |
|
83 | return $this->setParam('index_name_format', $indexNameFormat); |
|
84 | } |
|
85 | ||
86 | /** |
|
87 | * Set the timezone use when parsing the date. Default UTC. |
|
88 | * |
|
89 | * @param string $timezone |
|
90 | * |
|
91 | * @return $this |
|
92 | */ |
|
93 | public function setTimezone(string $timezone) |
|
94 | { |
|
95 | return $this->setParam('timezone', $timezone); |
|
96 | } |
|
97 | ||
98 | /** |
|
99 | * Set the locale to use when parsing the date. |
|
100 | * |
|
101 | * @param string $locale |
|
102 | * |
|
103 | * @return $this |
|
104 | */ |
|
105 | public function setLocale(string $locale) |
|
106 | { |
|
107 | return $this->setParam('locale', $locale); |
|
108 | } |
|
109 | } |
|
110 |
@@ 12-113 (lines=102) @@ | ||
9 | * |
|
10 | * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/kv-processor.html |
|
11 | */ |
|
12 | class Kv extends AbstractProcessor |
|
13 | { |
|
14 | /** |
|
15 | * Kv constructor. |
|
16 | * |
|
17 | * @param string $field |
|
18 | * @param string $fieldSplit |
|
19 | * @param string $valueSplit |
|
20 | */ |
|
21 | public function __construct(string $field, string $fieldSplit, string $valueSplit) |
|
22 | { |
|
23 | $this->setField($field); |
|
24 | $this->setFieldSplit($fieldSplit); |
|
25 | $this->setValueSplit($valueSplit); |
|
26 | } |
|
27 | ||
28 | /** |
|
29 | * Set field name. |
|
30 | * |
|
31 | * @param string $field |
|
32 | * |
|
33 | * @return $this |
|
34 | */ |
|
35 | public function setField(string $field) |
|
36 | { |
|
37 | return $this->setParam('field', $field); |
|
38 | } |
|
39 | ||
40 | /** |
|
41 | * Set field_split. |
|
42 | * |
|
43 | * @param string $fieldSplit |
|
44 | * |
|
45 | * @return $this |
|
46 | */ |
|
47 | public function setFieldSplit(string $fieldSplit) |
|
48 | { |
|
49 | return $this->setParam('field_split', $fieldSplit); |
|
50 | } |
|
51 | ||
52 | /** |
|
53 | * Set value_split. |
|
54 | * |
|
55 | * @param string $valueSplit |
|
56 | * |
|
57 | * @return $this |
|
58 | */ |
|
59 | public function setValueSplit(string $valueSplit) |
|
60 | { |
|
61 | return $this->setParam('value_split', $valueSplit); |
|
62 | } |
|
63 | ||
64 | /** |
|
65 | * Set target_field. Default value @timestamp. |
|
66 | * |
|
67 | * @param string $targetField |
|
68 | * |
|
69 | * @return $this |
|
70 | */ |
|
71 | public function setTargetField(string $targetField) |
|
72 | { |
|
73 | return $this->setParam('target_field', $targetField); |
|
74 | } |
|
75 | ||
76 | /** |
|
77 | * Set include_keys. |
|
78 | * |
|
79 | * @param array $listOfKeys |
|
80 | * |
|
81 | * @return $this |
|
82 | */ |
|
83 | public function setIncludeKeys(array $listOfKeys) |
|
84 | { |
|
85 | return $this->setParam('include_keys', $listOfKeys); |
|
86 | } |
|
87 | ||
88 | /** |
|
89 | * Set exclude_keys. |
|
90 | * |
|
91 | * @param array $listOfKeys |
|
92 | * |
|
93 | * @return $this |
|
94 | */ |
|
95 | public function setExcludeKeys(array $listOfKeys) |
|
96 | { |
|
97 | return $this->setParam('exclude_keys', $listOfKeys); |
|
98 | } |
|
99 | ||
100 | /** |
|
101 | * Set ignore_missing. Default value false. |
|
102 | * |
|
103 | * @param bool $ignoreMissing only these values are allowed (integer|float|string|boolean|auto) |
|
104 | * |
|
105 | * @return $this |
|
106 | */ |
|
107 | public function setIgnoreMissing(bool $ignoreMissing) |
|
108 | { |
|
109 | return $this->setParam('ignore_missing', $ignoreMissing); |
|
110 | } |
|
111 | } |
|
112 |