The OpenSearch JavaScript client provides a safer and easier way to interact with your OpenSearch cluster. Rather than using OpenSearch from the browser and potentially exposing your data to the public, you can build an OpenSearch client that takes care of sending requests to your cluster.
The client contains a library of APIs that let you perform different operations on your cluster and return a standard response body. The example here demonstrates some basic operations like creating an index, adding documents, and searching your data.
If you prefer to add the client manually or just want to examine the source code, see [opensearch-js](https://github.com/opensearch-project/opensearch-js) on GitHub.
As part of the client's library of APIs, a `memoryCircuitBreaker` gives you the ability to reject large query responses where the size of the response could crash OpenSearch Dashboards. To set the Circuit Breaker setting, use the [POST _cluster/settings]({{site.url}}{{site.baseurl}}/opensearch/rest-api/cluster-settings/) API operation on your active JS cluster.
-`enabled`: A boolean used to turn the circuit breaker on or off. Defaults to `false`.
-`maxPercentage`: The threshold that determines whether the Circuit Break engages. The input range must be between `[0 ,1]`. Any number that exceeds that range will correct to `1.0`.
The following example turns on the Circuit Breaker and sets the maximum percentage of a query response to 80% of the cluster's storage.