Note the (technically) breaking change and update docs.
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
---
|
||||
'@backstage/plugin-search-backend-module-elasticsearch': minor
|
||||
---
|
||||
|
||||
**BREAKING**: In order to remain interoperable with all currently supported
|
||||
deployments of Elasticsearch, this package will now conditionally use either
|
||||
the `@elastic/elasticsearch` or `@opensearch-project/opensearch` client when
|
||||
communicating with your deployed cluster.
|
||||
|
||||
If you do not rely on types exported from this package, or if you do not make
|
||||
use of the `createElasticSearchClientOptions` or `newClient` methods on the
|
||||
`ElasticSearchSearchEngine` class, then upgrading to this version should not
|
||||
require any further action on your part. Everything will continue to work as it
|
||||
always has.
|
||||
|
||||
If you _do_ rely on either of the above methods or any underlying types, some
|
||||
changes may be needed to your custom code. A type guard is now exported by this
|
||||
package (`isOpenSearchCompatible(options)`), which you may use to help clarify
|
||||
which client options are compatible with which client constructors.
|
||||
|
||||
If you are using this package with the `search.elasticsearch.provider` set to
|
||||
`aws`, and you are making use of the `newClient` method in particular, you may
|
||||
wish to start using the `@opensearch-project/opensearch` client in your custom
|
||||
code.
|
||||
@@ -80,15 +80,16 @@ const searchEngine = await ElasticSearchSearchEngine.initialize({
|
||||
const indexBuilder = new IndexBuilder({ logger: env.logger, searchEngine });
|
||||
```
|
||||
|
||||
For the engine to be available, your backend package needs a dependency into
|
||||
For the engine to be available, your backend package needs a dependency on
|
||||
package `@backstage/plugin-search-backend-module-elasticsearch`.
|
||||
|
||||
ElasticSearch needs some additional configuration before it is ready to use
|
||||
within your instance. The configuration options are documented in the
|
||||
[configuration schema definition file.](https://github.com/backstage/backstage/blob/master/plugins/search-backend-module-elasticsearch/config.d.ts)
|
||||
|
||||
The underlying functionality is using official ElasticSearch client version 7.x,
|
||||
meaning that ElasticSearch version 7 is the only one confirmed to be supported.
|
||||
The underlying functionality uses either the official ElasticSearch client
|
||||
version 7.x (meaning that ElasticSearch version 7 is the only one confirmed to
|
||||
be supported), or the OpenSearch client, when the `aws` provider is configured.
|
||||
|
||||
Should you need to create your own bespoke search experiences that require more
|
||||
than just a query translator (such as faceted search or Relay pagination), you
|
||||
@@ -97,9 +98,19 @@ search clients. The version of the client need not be the same as one used
|
||||
internally by the elastic search engine plugin. For example:
|
||||
|
||||
```typescript
|
||||
import { Client } from '@elastic/elastic-search';
|
||||
import { isOpenSearchCompatible } from '@backstage/plugin-search-backend-module-elasticsearch';
|
||||
import { Client as ElasticClient } from '@elastic/elastic-search';
|
||||
import { Client as OpenSearchClient } from '@opensearch-project/opensearch';
|
||||
|
||||
const client = searchEngine.newClient(options => new Client(options));
|
||||
const client = searchEngine.newClient(options => {
|
||||
// In reality, you would only import / instantiate one of the following, but
|
||||
// for illustrative purposes, here are both:
|
||||
if (isOpenSearchCompatible(options)) {
|
||||
return new OpenSearchClient(options);
|
||||
} else {
|
||||
return new ElasticClient(options);
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
#### Set custom index template
|
||||
|
||||
Reference in New Issue
Block a user