yiisoft / yii2-elasticsearch

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

Elasticsearch 8.x compatibility #321

Closed tehmaestro closed 2 years ago

tehmaestro commented 2 years ago
Q A
Is bugfix? ✔️
New feature?
Breaks BC?
Fixes https://github.com/yiisoft/yii2-elasticsearch/issues/319
Related to https://github.com/yiisoft/yii2-elasticsearch/pull/320

The tests on 6.8.9 fail, because elasticsearch does not recognize indices.id_field_data.enabled setting, which is needed because on 8.x you can no longer use _id to sort, unless you activate this setting. I'm open to suggestions :)

Also, I changed the commit from https://github.com/yiisoft/yii2-elasticsearch/pull/320 to check for dslVersion >= 7 , as on version 7 the calls were deprecated anyway.

beowulfenator commented 2 years ago

I think you can create env variables for specific jobs!

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idenv

I have no idea how to fix this, though.

lubosdz commented 2 years ago

This is quite unfortunate since fix for ES 8+ is quite badly needed. Are there some tests failing without "indices.id_field_data.enabled": "true" in test job? As far as I undertand it's an option quite rarely used (sorting by _id) and I only found for kibana (cloud) usage.

Also see setting env variable.

beowulfenator commented 2 years ago

I've spent two hours trying to get the tests to run and failed, and we clearly need somebody who's better at github actions.

So for full compatibility with ES 8 the extension needs to have indices.id_field_data.enabled env variable set to true, otherwise sorting by _id does not work. All other versions do not care about that env var, except ES 6.8.9 which fails to start. (I've tested with ES 6.8.21, it does not work either.)

The link above (setting the env variable) does not help. We need to conditionally set the variable in the service, not in the job.

I see no way to set up the ES 6.8 service differently from other ES services if we're using a matrix. This can be solved by just duplicating a bunch of lines from build.yml, but that's clearly not a good solution.

Stupid github :(

lubosdz commented 2 years ago

What tests are failing without indices.id_field_data.enabled : true ?

beowulfenator commented 2 years ago

Solved in #323.