yiisoft / yii2-elasticsearch

Yii 2 Elasticsearch extension
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
429 stars 252 forks source link

Type in delete by query command #326

Open Camper12345 opened 1 year ago

Camper12345 commented 1 year ago

https://github.com/yiisoft/yii2-elasticsearch/blob/c52c071ff92cd57bc4ddf9871c707497cb25f062/Command.php#L96

It seems like there is a bug that causes model type to be added to _delete_by_query request url even if dsl version is greater than 7. In most other functions in this file there is a check for that, but not in deleteByQuery.

B0rner commented 1 year ago

I can confirm this bug.
I have the same problem.
The problem: due to this bug, the functional tests in yii no longer work.
When using test fixtures and elastic search, yii seems to clean up the test data for each test. The yii framework uses exactly this function and runs into an error.
As a result, Elastic Search 8 does not work in codeception test at yii.

lubosdz commented 1 year ago

So it should be:

if ($this->db->dslVersion < 7 && $this->type !== null) {
    $url[] = $this->type;
}