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