Error Info: Array ( [requestMethod] => POST [requestUrl] => http://127.0.0.1:9200/goods/_doc/4509/_update [requestBody] => {"doc":{"fields":[{"id":45219,"good_id":4509,"field_id":166,"type_id":167,"category_id":172,"subcategory_id":111,"value":null,"value_int":2000},{"id":45220,"good_id":4509,"field_id":167,"type_id":167,"category_id":172,"subcategory_id":111,"value":null,"value_int":650},{"id":45221,"good_id":4509,"field_id":168,"type_id":167,"category_id":172,"subcategory_id":111,"value":null,"value_int":2200},{"id":45222,"good_id":4509,"field_id":169,"type_id":167,"category_id":172,"subcategory_id":111,"value":"2","value_int":null},{"id":45223,"good_id":4509,"field_id":170,"type_id":167,"category_id":172,"subcategory_id":111,"value":"Ясень Анкор светлый","value_int":null},{"id":45224,"good_id":4509,"field_id":171,"type_id":167,"category_id":172,"subcategory_id":111,"value":"Ясень Анкор светлый","value_int":null},{"id":45225,"good_id":4509,"field_id":172,"type_id":167,"category_id":172,"subcategory_id":111,"value":"ЛДСП","value_int":null},{"id":45226,"good_id":4509,"field_id":173,"type_id":167,"category_id":172,"subcategory_id":111,"value":"ЛДСП","value_int":null}]}} [responseCode] => 429 [responseHeaders] => Array ( [warning] => 299 Elasticsearch-7.10.2-747e1cc71def077253878a59143c1f785afa92b9 "[types removal] Specifying types in document update requests is deprecated, use the endpoint /{index}/_update/{id} instead." [content-type] => application/json; charset=UTF-8 [content-length] => 393 ) [responseBody] => Array ( [error] => Array ( [root_cause] => Array ( [0] => Array ( [type] => cluster_block_exception [reason] => index [goods] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block]; ) ) [type] => cluster_block_exception [reason] => index [goods] blocked by: [TOO_MANY_REQUESTS/12/disk usage exceeded flood-stage watermark, index has read-only-allow-delete block]; ) [status] => 429 ) )
'requestBody' => $requestBody, 'responseCode' => $responseCode, 'responseHeaders' => $headers, 'responseBody' => $this->decodeErrorBody($body), ]); } } elseif ($responseCode == 404) { return false; } else { throw new Exception("Elasticsearch request failed with code $responseCode. Response body:\n{$body}", [ 'requestMethod' => $method, 'requestUrl' => $url, 'requestBody' => $requestBody, 'responseCode' => $responseCode, 'responseHeaders' => $headers, 'responseBody' => $this->decodeErrorBody($body), ]); } }
* @throws Exception * @throws InvalidConfigException */ public function post($url, $options = [], $body = null, $raw = false) { $this->open(); return $this->httpRequest('POST', $this->createUrl($url, $options), $body, $raw); } /** * Performs PUT HTTP request * * @param string|array $url URL
unset($options["detect_noop"]); } if ($this->db->dslVersion >= 7) { return $this->db->post([$index, '_update', $id], $options, Json::encode($body)); } else { return $this->db->post([$index, $type, $id, '_update'], $options, Json::encode($body)); } } // TODO bulk https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html /**
$options['version'] = $this->_version; unset($options['optimistic_locking']); } try { $result = static::getDb()->createCommand()->update( static::index(), static::type(), $this->getOldPrimaryKey(false), $values, $options ); } catch (Exception $e) {
*/ public function update($runValidation = true, $attributeNames = null, $options = []) { if ($runValidation && !$this->validate($attributeNames)) { return false; } return $this->updateInternal($attributeNames, $options); } /** * @param array $attributes attributes to update * @param array $options options given in this parameter are passed to Elasticsearch * as request URI parameters. See [[update()]] for details.
public function save($runValidation = true, $attributeNames = null) { if ($this->getIsNewRecord()) { return $this->insert($runValidation, $attributeNames); } return $this->update($runValidation, $attributeNames) !== false; } /** * Saves the changes to this active record into the associated database table. * * This method performs the following steps in order:
if(!$elastic) { $elastic = new $this->classElasticModel(); $elastic->primaryKey = $this->owner->id; } $this->fillElastic($elastic, $changedAttributes); $s = $elastic->save(); return $s; } protected function getPropertyName($ownerAttr) {
$event->sender = $this; } $event->handled = false; $event->name = $name; foreach ($eventHandlers as $handler) { $event->data = $handler[1]; call_user_func($handler[0], $event); // stop further handling if the event is handled if ($event->handled) { return; } } }
* [[\yii\behaviors\AttributeTypecastBehavior]] to facilitate attribute typecasting. * See https://www.yiiframework.com/doc-2.0/guide-db-active-record.html#attributes-typecasting. */ public function afterSave($insert, $changedAttributes) { $this->trigger($insert ? self::EVENT_AFTER_INSERT : self::EVENT_AFTER_UPDATE, new AfterSaveEvent([ 'changedAttributes' => $changedAttributes, ])); } /** * This method is invoked before deleting a record. *
$changedAttributes = []; foreach ($values as $name => $value) { $changedAttributes[$name] = isset($this->_oldAttributes[$name]) ? $this->_oldAttributes[$name] : null; $this->_oldAttributes[$name] = $value; } $this->afterSave(false, $changedAttributes); return $rows; } /** * Updates one or several counter columns for the current AR object.
if ($runValidation && !$this->validate($attributeNames)) { Yii::info('Model not updated due to validation error.', __METHOD__); return false; } if (!$this->isTransactional(self::OP_UPDATE)) { return $this->updateInternal($attributeNames); } $transaction = static::getDb()->beginTransaction(); try { $result = $this->updateInternal($attributeNames); if ($result === false) {
public function save($runValidation = true, $attributeNames = null) { if ($this->getIsNewRecord()) { return $this->insert($runValidation, $attributeNames); } return $this->update($runValidation, $attributeNames) !== false; } /** * Saves the changes to this active record into the associated database table. * * This method performs the following steps in order:
->one(); if (!$item) { throw new yii\web\NotFoundHttpException(); } $item->countViewsUp(); $item->save(); $company = Company::findOne($item['company_id']); $goods = \Yii::$app->offerGoods->getSimilar($item); $category = false; $subcategory = false;
$args = $this->controller->bindActionParams($this, $params); Yii::debug('Running action: ' . get_class($this->controller) . '::' . $this->actionMethod . '()', __METHOD__); if (Yii::$app->requestedParams === null) { Yii::$app->requestedParams = $args; } return call_user_func_array([$this->controller, $this->actionMethod], $args); } }
} $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules foreach ($modules as $module) { /* @var $module Module */
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
require(__DIR__ . '/vendor/autoload.php'); require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php'); $config = require(__DIR__ . '/app/config/web.php'); (new yii\web\Application($config))->run();
$_GET = [ 'id' => 4509, ];