# Opensearch node.js client

**URL:** <https://forum.opensearch.org/t/opensearch-node-js-client/9353>\
**Category:** Open Source Elasticsearch and Kibana\
**Tags:** all-clients, troubleshoot\
**Created:** [April 22, 2022, 4:46pm UTC](https://forum.opensearch.org/t/opensearch-node-js-client/9353 "2022-04-22T16:46:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![tomburnell](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@tomburnell](https://forum.opensearch.org/u/tomburnell)\
**Post date:** [April 22, 2022, 4:46pm UTC](https://forum.opensearch.org/t/opensearch-node-js-client/9353/1 "2022-04-22T16:46:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nateynate](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/nateynate/32/4913_2.png) [@nateynate](https://forum.opensearch.org/u/nateynate)\
**Post date:** [April 22, 2022, 7:36pm UTC](https://forum.opensearch.org/t/opensearch-node-js-client/9353/2 "2022-04-22T19:36:41Z")

</div>

Hi @tomburnell -

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

> **[Carrying forward the OpenSearch client libraries as a community](https://opensearch.org/blog/community/2021/08/community-clients/)**
>
> OpenSearch is a community-driven, Apache 2.0-licensed open source search and analytics suite that makes it easy to ingest, search, visualize, and analyze data.

A quick excerpt:

> Starting with version 7.14, multiple of the [clients maintained by Elastic](https://www.elastic.co/guide/en/elasticsearch/client/index.html) contain [new logic](https://github.com/elastic/elasticsearch-py/pull/1623) that rejects connections to OpenSearch clusters or to clusters running open source distributions of Elasticsearch 7. This includes the [Apache-licensed distribution](https://www.elastic.co/downloads/past-releases/elasticsearch-oss-7-10-2) provided by Elastic, as well as community distributions like [Open Distro for Elasticsearch](https://opendistro.github.io/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](https://opensearch.org/docs/clients/index/) 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

---

<div class="post-metadata">

**Author:** ![tomburnell](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@tomburnell](https://forum.opensearch.org/u/tomburnell)\
**Post date:** [April 25, 2022, 3:54pm UTC](https://forum.opensearch.org/t/opensearch-node-js-client/9353/3 "2022-04-25T15:54:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nateynate](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/nateynate/32/4913_2.png) [@nateynate](https://forum.opensearch.org/u/nateynate)\
**Post date:** [April 25, 2022, 5:35pm UTC](https://forum.opensearch.org/t/opensearch-node-js-client/9353/4 "2022-04-25T17:35:38Z")

</div>

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:

> **[GitHub - opensearch-project/opensearch-js: Node.js Client for OpenSearch](https://github.com/opensearch-project/opensearch-js)**
>
> Node.js Client for OpenSearch. Contribute to opensearch-project/opensearch-js development by creating an account on GitHub.

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
