| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- namespace Elastica\Processor;
- /**
- * Elastica DateIndexName Processor.
- *
- * @author Federico Panini <fpanini@gmail.com>
- *
- * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/date-index-name-processor.html
- */
- class DateIndexName extends AbstractProcessor
- {
- /**
- * DateIndexName constructor.
- *
- * @param string $field
- * @param string $dateRounding
- */
- public function __construct(string $field, string $dateRounding)
- {
- $this->setField($field);
- $this->setDateRounding($dateRounding);
- }
- /**
- * Set field.
- *
- * @param string $field
- *
- * @return $this
- */
- public function setField(string $field)
- {
- return $this->setParam('field', $field);
- }
- /**
- * Set date_rounding. Valid values are: y (year), M (month), w (week), d (day), h (hour), m (minute) and s (second).
- *
- * @param string $dateRounding
- *
- * @return $this
- */
- public function setDateRounding(string $dateRounding)
- {
- return $this->setParam('date_rounding', $dateRounding);
- }
- /**
- * Set field formats. Joda pattern or one of the following formats ISO8601, UNIX, UNIX_MS, or TAI64N.
- *
- * @param array $formats
- *
- * @return $this
- */
- public function setDateFormats(array $formats)
- {
- return $this->setParam('date_formats', $formats);
- }
- /**
- * Set index_prefix_name.
- *
- * @param string $indexPrefixName
- *
- * @return $this
- */
- public function setIndexNamePrefix(string $indexPrefixName)
- {
- return $this->setParam('index_name_prefix', $indexPrefixName);
- }
- /**
- * Set format to be used when printing parsed date. An valid Joda pattern is expected here. Default yyyy-MM-dd.
- *
- * @param string $indexNameFormat
- *
- * @return $this
- */
- public function setIndexNameFormat(string $indexNameFormat)
- {
- return $this->setParam('index_name_format', $indexNameFormat);
- }
- /**
- * Set the timezone use when parsing the date. Default UTC.
- *
- * @param string $timezone
- *
- * @return $this
- */
- public function setTimezone(string $timezone)
- {
- return $this->setParam('timezone', $timezone);
- }
- /**
- * Set the locale to use when parsing the date.
- *
- * @param string $locale
- *
- * @return $this
- */
- public function setLocale(string $locale)
- {
- return $this->setParam('locale', $locale);
- }
- }
|