Opensearch node.js client

Hi,
I’ve been building a web app and using Elasticsearch. I wanted to deploy to AWS and starting having compatibilities issues using ES client with AWS ES/Opensearch.

First question I have: Is it possible to use the standard ES client with AWS Elastic Search 7. I was getting compatibility errors. Have ES done something to stop their client working with AWS deployed ES?

I then started to migrate to Opensearch. I’ve installed Opensearch locally and switched to the opensearch node.js client. It seems like Opensearch itself uses the same http queries and responses as ElasticSearch. But the node.js api does not match the Elastic Search Api. Why is this?
I have to wrap my “query” objects in “body”: {} and the responses are now resp.body.hit.hits rather than resp.hits.hits.
This has meant many changes to my code and makes it incompatible with ES now.

Is there a reason for the client being like this? Why not keep it the same to better facility switching between the two?

Thanks for any insight, Tom

Hi @tomburnell -

This blog article might shed some light on your situation regarding the opensearch client libraries.

A quick excerpt:

Starting with version 7.14, multiple of the clients maintained by Elastic contain new logic that rejects connections to OpenSearch clusters or to clusters running open source distributions of Elasticsearch 7. This includes the Apache-licensed distribution provided by Elastic, as well as community distributions like Open Distro for Elasticsearch.
For the time being, people who use open source Elasticsearch, Open Distro, or OpenSearch should avoid upgrading to version 7.14 of these client libraries as this may break applications. Please see this documentation for recommended versions of client libraries that have been tested to work with open source Elasticsearch, Open Distro, and OpenSearch.

I hope that was what you were asking about - let me know if I missed.

Nate

Hi Nate,
Thanks - that answers the first part about ES client compatibility with AWS.

Are you able to shed any light on the why open source client is choosing to wrap calls/responses in “body”: {} - which differs from how ES client behaves.

Cheers, Tom

I’m honestly not quite sure what the motivations were for having it behave the way it does, however you’re more than welcome to open up an issue in the github repo for the client here:

I’m sure the maintainers would be more than happy to provide you some insight - I’ll also see if I can’t get a developer to respond here in the forums to get you a quicker response.

Nate