cube icon indicating copy to clipboard operation
cube copied to clipboard

cubejs-elasticsearch-driver not compatible with v7.x

Open gabri94 opened this issue 3 years ago • 10 comments

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

gabri94 avatar Oct 07 '21 10:10 gabri94

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.

github-actions[bot] avatar Oct 07 '21 10:10 github-actions[bot]

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.

gabri94 avatar Oct 07 '21 12:10 gabri94

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

gabri94 avatar Oct 07 '21 12:10 gabri94

Hey @gabri94 ! PR would be very much appreciated!

paveltiunov avatar Oct 19 '21 07:10 paveltiunov

Any chance of getting this merged in? @gabri94 fix seems to work with Elastic Cloud which is running on 7.16

stueccles avatar Jan 07 '22 19:01 stueccles

@stueccles @gabri94 We just need a PR here.

paveltiunov avatar Mar 01 '22 04:03 paveltiunov

Any update on the PR @gabri94 ?

AlbanCrepel avatar Mar 25 '22 09:03 AlbanCrepel

The fix is only partially working, so It doesn't make sense to merge it.

gabri94 avatar Mar 25 '22 10:03 gabri94

issue still persist (trying with ElasticSearch 7.15)

nassima-creator avatar May 31 '22 08:05 nassima-creator

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

shivam145 avatar Jun 23 '22 09:06 shivam145

any updates on this?

madurangaRA avatar Nov 23 '22 03:11 madurangaRA

I have similar issue on latest elasticsearch: 8.6.2

tewnut avatar Mar 07 '23 04:03 tewnut