Closed hkui closed 3 years ago
@beowulfenator would you please take a look?
This is not an error, this is expected behavior of elasticsearch. An item is fully deleted after the corresponding shard is refreshed. See https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-refresh.html.
You're attempting to suppress errors that arise when trying to delete non-existent items.
Try
$r1 = $this->model->deleteAll(['id'=>1]);
$this->model->db->createCommand()->refreshIndex(($this->model)::index());
$r2 = $this->model->deleteAll(['id'=>1]);
var_dump($r1);
var_dump($r2);
For an existing record, delete it twice in a row. Immediately after the first deletion, 404 is returned for the second deletion
The code Below will repoer errors "yii\elasticsearch\ActiveRecord::deleteAll failed deleting records"
Because you can still find the data when you query immediately after deletion