A wrapper class that exposes logical methods that are conditionally fired
against either a configured Elasticsearch client or a configured Opensearch
client.
This is necessary because, despite its intention to be API-compatible, the
opensearch client does not support API key-based authentication. This is
also the sanest way to accomplish this while making typescript happy.
In the future, if the differences between implementations become
unmaintainably divergent, we should split out the Opensearch and
Elasticsearch search engine implementations.
The Elasticsearch client calls below pass { meta: true }. As of v8 the
@elastic/elasticsearch client returns the response body directly, whereas
the Opensearch client (forked from the v7 Elasticsearch client) still wraps
it in { body, statusCode, headers, ... }. Requesting the meta envelope
keeps both clients returning the same shape, so consumers can continue to
read response.body regardless of the configured provider.
A wrapper class that exposes logical methods that are conditionally fired against either a configured Elasticsearch client or a configured Opensearch client.
This is necessary because, despite its intention to be API-compatible, the opensearch client does not support API key-based authentication. This is also the sanest way to accomplish this while making typescript happy.
In the future, if the differences between implementations become unmaintainably divergent, we should split out the Opensearch and Elasticsearch search engine implementations.
The Elasticsearch client calls below pass
{ meta: true }. As of v8 the@elastic/elasticsearchclient returns the response body directly, whereas the Opensearch client (forked from the v7 Elasticsearch client) still wraps it in{ body, statusCode, headers, ... }. Requesting the meta envelope keeps both clients returning the same shape, so consumers can continue to readresponse.bodyregardless of the configured provider.