yii\elasticsearch\ActiveRecord::update PHP Method

update() public method

public update ( boolean $runValidation = true, array $attributeNames = null, array $options = [] ) : integer | boolean
$runValidation boolean whether to perform validation before saving the record. If the validation fails, the record will not be inserted into the database.
$attributeNames array list of attribute names that need to be saved. Defaults to null, meaning all attributes that are loaded from DB will be saved.
$options array options given in this parameter are passed to elasticsearch as request URI parameters. These are among others: - `routing` define shard placement of this record. - `parent` by giving the primaryKey of another record this defines a parent-child relation - `timeout` timeout waiting for a shard to become available. - `replication` the replication type for the delete/index operation (sync or async). - `consistency` the write consistency of the index/delete operation. - `refresh` refresh the relevant primary and replica shards (not the whole index) immediately after the operation occurs, so that the updated document appears in search results immediately. - `detect_noop` this parameter will become part of the request body and will prevent the index from getting updated when nothing has changed. Please refer to the [elasticsearch documentation](http://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html#_parameters_3) for more details on these options. The following parameters are Yii specific: - `optimistic_locking` set this to `true` to enable optimistic locking, avoid updating when the record has changed since it has been loaded from the database. Yii will set the `version` parameter to the value stored in [[version]]. See the [elasticsearch documentation](http://www.elastic.co/guide/en/elasticsearch/guide/current/optimistic-concurrency-control.html) for details. Make sure the record has been fetched with a [[version]] before. This is only the case for records fetched via [[get()]] and [[mget()]] by default. For normal queries, the `_version` field has to be fetched explicitly.
return integer | boolean the number of rows affected, or false if validation fails or [[beforeSave()]] stops the updating process.
    public function update($runValidation = true, $attributeNames = null, $options = [])
    {
        if ($runValidation && !$this->validate($attributeNames)) {
            return false;
        }
        return $this->updateInternal($attributeNames, $options);
    }