yii\elasticsearch\ActiveRecord::setPrimaryKey PHP Method

setPrimaryKey() public method

Sets the primary key
public setPrimaryKey ( mixed $value )
$value mixed
    public function setPrimaryKey($value)
    {
        $pk = static::primaryKey()[0];
        if ($this->getIsNewRecord() || $pk != '_id') {
            $this->{$pk} = $value;
        } else {
            throw new InvalidCallException('Changing the primaryKey of an already saved record is not allowed.');
        }
    }