cube
cube copied to clipboard
cubejs-elasticsearch-driver not compatible with v7.x
Describe the bug The backend package works with elasticsearch up to v6.8. With v7.x it causes the following error:
ResponseError: illegal_argument_exception
at onBody (/cube/node_modules/@elastic/elasticsearch/lib/Transport.js:337:23)
at IncomingMessage.onEnd (/cube/node_modules/@elastic/elasticsearch/lib/Transport.js:264:11)
at IncomingMessage.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
I've tested this behaviour both with elastic.io and a local vanilla elasticsearch v7.15 image. On the other hand, the library works correctly with elasticsearch v.6.8.18
To Reproduce Steps to reproduce the behavior:
- Deploy elasticsearch v7.15 using docker.
- Try to connect cube.js by following the instructions on the wiki
- Open the cube.js schema and see the error.
Expected behavior The lib should work with the latest version of elasticsearch
If you are interested in working on this issue, please leave a comment below and we will be happy to assign the issue to you. If this is the first time you are contributing a Pull Request to Cube.js, please check our contribution guidelines. You can also post any questions while contributing in the #contributors channel in the Cube.js Slack.
By further investigating it looks like at line 134 tries to cal getMapping on the index '.geoip_databases', which causes the exception.
https://github.com/cube-js/cube.js/blob/565465a02328875340d63046245637a3544ce2f1/packages/cubejs-elasticsearch-driver/driver/ElasticSearchDriver.js#L134
In version 6.8 this caused an error, but the || {}
was sufficient to make it work. In v 7.15 this causes the illegal_argument_exception
errror.
I came up with this fix https://github.com/gabri94/cube.js/commit/42dd257634c948625263d3d0cdeef3cf5fc713ac
If you think it's ok, I will open a PR
Hey @gabri94 ! PR would be very much appreciated!
Any chance of getting this merged in? @gabri94 fix seems to work with Elastic Cloud which is running on 7.16
@stueccles @gabri94 We just need a PR here.
Any update on the PR @gabri94 ?
The fix is only partially working, so It doesn't make sense to merge it.
issue still persist (trying with ElasticSearch 7.15)
i had made changes as present in @gabri94 's PR and also added a small tweak in one of the line as shown below and it worked for me in version 7.14.1
const props = mappings.body[index].mappings.properties || {};
@nassima-creator please can you try to connect to elastic 7.15 with the mentioned changes
any updates on this?
I have similar issue on latest elasticsearch: 8.6.2