Hi, I try to update elasticsearch from "elasticsearch": "^15.1.1" to "@elastic/elasticsearch": "^7.0.0-rc.1"
Here is my change for init Client
const esClient = new Client({
nodes: [ 'someNode' ],
ConnectionPool: require('http-aws-es')
})
When I query the es endpoint. I got the error as below:
TypeError: Invalid host
at HttpAmazonESConnector.ConnectionAbstract (/myLocalFolder/node_modules/elasticsearch/src/lib/connection.js:27:11)
at HttpAmazonESConnector.HttpConnector (/myLocalFolder/node_modules/elasticsearch/src/lib/connectors/http.js:32:22)
at HttpAmazonESConnector (/myLocalFolder/node_modules/http-aws-es/connector.js:20:5)
at ConnectionPool.addConnection (/myLocalFolder/node_modules/@elastic/elasticsearch/lib/ConnectionPool.js:230:24)
at opts.forEach.o (/myLocalFolder/node_modules/@elastic/elasticsearch/lib/ConnectionPool.js:211:30)
at Array.forEach (native)
at ConnectionPool.addConnection (/myLocalFolder/node_modules/@elastic/elasticsearch/lib/ConnectionPool.js:211:12)
at Client (/myLocalFolder/node_modules/@elastic/elasticsearch/index.js:104:27)
is there anything missing for my change?
It's not uncommon that somebody already opened an issue or in the best case it's already fixed but not merged. That's the reason why you should search at first before submitting a new one.
Hello! The new client has completely different internals, so code that you have written to interact with the old client internals will not work with the new one.
I've opened https://github.com/TheDeveloper/http-aws-es/issues/63 to inform the author of http-aws-es about this.
Thanks for info. I will keep watching on this.
We understand that this might be important for you, but this issue has been automatically marked as stale because it has not had recent activity either from our end or yours.
It will be closed if no further activity occurs, please write a comment if you would like to keep this going.
Note: in the past months we have built a new client, that has just landed in master. If you want to open an issue or a pr for the legacy client, you should do that in https://github.com/elastic/elasticsearch-js-legacy
Hey, has there been any update on this?
Hi @parthdesai93, not that I'm aware of.
See https://github.com/TheDeveloper/http-aws-es/issues/63.
Yup, I checked that. Is it possible for you to just point me what part should I be looking at extending in the client? Connection or Transport? Or You think that's not the correct approach?
You should extend the Connection class.
Theoretically, you should just update http-aws-es to use the new client internals.
To anyone looking for the updated version, here is a sample gist[0] that fit our requirements. I'll look into submitting a PR/publishing a new package when I get a bit of time.
[0] https://gist.github.com/parthdesai93/1bd3a25ad4cf788d49ce4a00a1bb3268
We've released an NPM package that works with @elastic/eleasticsearch and AWS elasticsearch clusters. It signs the requests for AWS and refreshes the credentials when they're about to expire.
https://www.npmjs.com/package/@acuris/aws-es-connection
https://github.com/mergermarket/acuris-aws-es-connection
Most helpful comment
We've released an NPM package that works with @elastic/eleasticsearch and AWS elasticsearch clusters. It signs the requests for AWS and refreshes the credentials when they're about to expire.
https://www.npmjs.com/package/@acuris/aws-es-connection
https://github.com/mergermarket/acuris-aws-es-connection