Set.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace Elastica\Processor;
  3. /**
  4. * Elastica Set Processor.
  5. *
  6. * @author Federico Panini <fpanini@gmail.com>
  7. *
  8. * @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ingest-processors.html
  9. */
  10. class Set extends AbstractProcessor
  11. {
  12. /**
  13. * Set constructor.
  14. *
  15. * @param string $field field name
  16. * @param string $value field value
  17. */
  18. public function __construct(string $field, string $value)
  19. {
  20. $this->setField($field);
  21. $this->setValue($value);
  22. }
  23. /**
  24. * Set field.
  25. *
  26. * @param string $field
  27. *
  28. * @return $this
  29. */
  30. public function setField(string $field)
  31. {
  32. return $this->setParam('field', $field);
  33. }
  34. /**
  35. * Set field value.
  36. *
  37. * @param string $value
  38. *
  39. * @return $this
  40. */
  41. public function setValue(string $value)
  42. {
  43. return $this->setParam('value', $value);
  44. }
  45. /**
  46. * Set override. Default true.
  47. *
  48. * @param bool $override
  49. *
  50. * @return $this
  51. */
  52. public function setOverride(bool $override)
  53. {
  54. return $this->setParam('override', $override);
  55. }
  56. }