Merge pull request #15588 from backstage/docs/search-docs
[Documentation] Minor improvements to search section
This commit is contained in:
@@ -23,7 +23,8 @@ See the more detailed [architecture](./architecture.md) and [tech stack](./archi
|
||||
|
||||
## Project roadmap
|
||||
|
||||
No current plans.
|
||||
No current plans. Check [Backstage issues labeled `search`](https://github.com/backstage/backstage/issues?q=is%3Aopen+is%3Aissue+label%3Asearch)
|
||||
for community-led ideas and initiatives.
|
||||
|
||||
## Supported
|
||||
|
||||
@@ -42,11 +43,11 @@ The following sections show the plugins and search engines currently supported b
|
||||
See [Backstage Search Architecture](architecture.md) to get an overview of how
|
||||
the search engines are used.
|
||||
|
||||
| Search Engines | Support Status |
|
||||
| -------------------------------------------------- | -------------- |
|
||||
| [ElasticSearch](./search-engines.md#elasticsearch) | ✅ |
|
||||
| [Lunr](./search-engines.md#lunr) | ✅ |
|
||||
| [Postgres](./search-engines.md#postgres) | Community ✅ |
|
||||
| Search Engines | Support Status |
|
||||
| ------------------------------------------------------------- | -------------- |
|
||||
| [Elasticsearch/OpenSearch](./search-engines.md#elasticsearch) | ✅ |
|
||||
| [Lunr](./search-engines.md#lunr) | ✅ |
|
||||
| [Postgres](./search-engines.md#postgres) | Community ✅ |
|
||||
|
||||
[Reach out to us](#get-involved) if you want to chat about support for more plugin integrations and
|
||||
search engines.
|
||||
@@ -56,72 +57,3 @@ search engines.
|
||||
For any questions, feedback, or to help move search forward, reach out to us in
|
||||
the **#search** channel of our
|
||||
[Discord chatroom](https://github.com/backstage/backstage#community).
|
||||
|
||||
## Use Cases supported
|
||||
|
||||
#### **Backstage Search Pre-Alpha**
|
||||
|
||||
Search Frontend letting you search through the entities of the software catalog.
|
||||
|
||||
The pre-alpha is intended to solve for the following user stories, but will get
|
||||
there by means of a front-end only, non-extensible MVP.
|
||||
|
||||
- As a software engineer I should be able to navigate to a search page and
|
||||
search for entities registered in the Software Catalog.
|
||||
- As a software engineer I should be able to use the search input field in the
|
||||
sidebar to search for entities registered in the Software Catalog.
|
||||
- As a software engineer I should be able to see the number of results my search
|
||||
returned.
|
||||
- As a software engineer I should be able to filter on metadata (kind,
|
||||
lifecycle) when I’ve performed a search.
|
||||
- As a software engineer I should be able to hide the filters if I don’t need to
|
||||
use them.
|
||||
|
||||
#### **Backstage Search Alpha**
|
||||
|
||||
Basic “out-of-the-box” in-memory indexing process of entities, and their metadata, registered to the Software Catalog.
|
||||
|
||||
We will consider Backstage Search to be in alpha when the above use-cases are
|
||||
met, but built on top of a flexible, extensible platform.
|
||||
|
||||
- As an integrator, I should be able to provide all of the pre-alpha experiences
|
||||
to my users if I choose, but also be able to customize the experience using a
|
||||
composable set of components.
|
||||
- As a plugin developer, I should have a standard way to expose my plugin's data
|
||||
to Backstage Search.
|
||||
- As an integrator, I should still be able to expose everything in the Software
|
||||
Catalog in search, but it should be possible to customize what is searchable.
|
||||
- As an integrator, although I should be able to customize all of the above, it
|
||||
should be possible to have the pre-alpha user experiences covered without
|
||||
having to set up and configure a search engine.
|
||||
|
||||
#### **Backstage Search Beta**
|
||||
|
||||
At least one production-ready search engine that supports the same use-cases as in the alpha.
|
||||
|
||||
We will consider Backstage Search to be in a beta phase when the above use-cases
|
||||
are met, and can be deployed using a production-ready search engine.
|
||||
|
||||
- As an integrator, I should be able to power my Backstage Search experience
|
||||
(including querying and indexing) using a production-ready search engine like
|
||||
ElasticSearch.
|
||||
- As an integrator, I should be able to configure the connection to my search
|
||||
engine in **app_config.yaml**.
|
||||
- As an integrator, I should be able to tune the queries sent to my chosen
|
||||
search engine according to my organization's needs, but a sensible default
|
||||
query should be in place so that I am not required to do so.
|
||||
|
||||
#### **Backstage Search 1.0**
|
||||
|
||||
A stable Search API for plugin developers to add search to their plugins, and app integrators to expose that to their users.
|
||||
|
||||
We will consider Backstage Search to be 1.0 when the above
|
||||
use-cases are met, and an ecosystem of search-enabled plugins are available and
|
||||
stable.
|
||||
|
||||
- As a plugin developer, there should be at least one example of a Backstage
|
||||
plugin that integrates with search that I can use as inspiration for my own
|
||||
plugin's search capabilities (for example, the TechDocs plugin).
|
||||
- As an app integrator, there should be plenty of examples and documentation on
|
||||
how to customize and extend search in my Backstage instance to meet my
|
||||
organization's needs.
|
||||
|
||||
@@ -23,7 +23,7 @@ To get started, you should get familiar with these core concepts:
|
||||
Backstage Search isn't a search engine itself, rather, it provides an interface
|
||||
between your Backstage instance and a Search Engine of your choice. More
|
||||
concretely, a `SearchEngine` is an interface whose concrete implementations
|
||||
facilitate communication with different search engines (like ElasticSearch,
|
||||
facilitate communication with different search engines (like Elasticsearch,
|
||||
Lunr, Solr, etc). This abstraction exists in order to support your
|
||||
organization's needs.
|
||||
|
||||
|
||||
@@ -286,7 +286,7 @@ an example:
|
||||
Backstage Search isn't a search engine itself, rather, it provides an interface
|
||||
between your Backstage instance and a
|
||||
[Search Engine](./concepts.md#search-engines) of your choice. Currently, we only
|
||||
support two engines, an in-memory search Engine called Lunr and ElasticSearch.
|
||||
support two engines, an in-memory search Engine called Lunr and Elasticsearch.
|
||||
See [Search Engines](./search-engines.md) documentation for more information how
|
||||
to configure these in your Backstage instance.
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ description: Choosing and configuring your search engine for Backstage
|
||||
---
|
||||
|
||||
Backstage supports 3 search engines by default, an in-memory engine called Lunr,
|
||||
ElasticSearch and Postgres. You can configure your own search engines by
|
||||
Elasticsearch and Postgres. You can configure your own search engines by
|
||||
implementing the provided interface as mentioned in the
|
||||
[search backend documentation.](./getting-started.md#Backend)
|
||||
|
||||
@@ -34,11 +34,16 @@ const searchEngine = new LunrSearchEngine({ logger: env.logger });
|
||||
const indexBuilder = new IndexBuilder({ logger: env.logger, searchEngine });
|
||||
```
|
||||
|
||||
> Note: Lunr is appropriate as a zero-config search engine when developing
|
||||
> other parts of Backstage locally, however its use is highly discouraged when
|
||||
> running Backstage in production. When deploying Backstage, use one of the
|
||||
> other search engines instead.
|
||||
|
||||
## Postgres
|
||||
|
||||
The Postgres based search engine only requires that postgres being configured as
|
||||
the database engine for Backstage. Therefore it targets setups that want to
|
||||
avoid maintaining another external service like elastic search. The search
|
||||
avoid maintaining another external service like Elasticsearch. The search
|
||||
provides decent results and performs well with ten thousands of indexed
|
||||
documents. The connection to postgres is established via the database manager
|
||||
also used by other plugins.
|
||||
@@ -91,13 +96,13 @@ search:
|
||||
|
||||
The Postgres documentation on [Highlighting Results](https://www.postgresql.org/docs/current/textsearch-controls.html#TEXTSEARCH-HEADLINE) has more details.
|
||||
|
||||
## ElasticSearch
|
||||
## Elasticsearch
|
||||
|
||||
Backstage supports ElasticSearch search engine connections, indexing and
|
||||
querying out of the box. Available configuration options enable usage of either
|
||||
AWS or Elastic.co hosted solutions, or a custom self-hosted solution.
|
||||
Backstage supports Elasticsearch (and OpenSearch) search engine connections,
|
||||
indexing and querying out of the box. Available configuration options enable
|
||||
usage of either AWS or Elastic.co hosted solutions, or a custom self-hosted solution.
|
||||
|
||||
Similarly to Lunr above, ElasticSearch can be set up like this:
|
||||
Similarly to Lunr above, Elasticsearch can be set up like this:
|
||||
|
||||
```typescript
|
||||
// app/backend/src/plugins/search.ts
|
||||
@@ -111,20 +116,20 @@ const indexBuilder = new IndexBuilder({ logger: env.logger, searchEngine });
|
||||
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
|
||||
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 uses either the official ElasticSearch client
|
||||
version 7.x (meaning that ElasticSearch version 7 is the only one confirmed to
|
||||
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` or `opensearch `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
|
||||
can access the configuration of the search engine in order to create new elastic
|
||||
search clients. The version of the client need not be the same as one used
|
||||
internally by the elastic search engine plugin. For example:
|
||||
can access the configuration of the search engine in order to create new
|
||||
Elasticsearch clients. The version of the client need not be the same as one
|
||||
used internally by the Elasticsearch engine plugin. For example:
|
||||
|
||||
```typescript
|
||||
import { isOpenSearchCompatible } from '@backstage/plugin-search-backend-module-elasticsearch';
|
||||
@@ -144,7 +149,7 @@ const client = searchEngine.newClient(options => {
|
||||
|
||||
#### Set custom index template
|
||||
|
||||
The elasticsearch engine gives you the ability to set a custom index template if needed.
|
||||
The Elasticsearch engine gives you the ability to set a custom index template if needed.
|
||||
|
||||
> Index templates define settings, mappings, and aliases that can be applied automatically to new indices.
|
||||
|
||||
@@ -171,8 +176,8 @@ searchEngine.setIndexTemplate({
|
||||
|
||||
### AWS
|
||||
|
||||
Using AWS hosted ElasticSearch the only configuration option needed is the URL
|
||||
to the ElasticSearch service. The implementation assumes that environment
|
||||
Using AWS hosted Elasticsearch the only configuration option needed is the URL
|
||||
to the Elasticsearch service. The implementation assumes that environment
|
||||
variables for AWS access key id and secret access key are defined in accordance
|
||||
to the
|
||||
[default AWS credential chain.](https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/setting-credentials-node.html).
|
||||
@@ -186,8 +191,8 @@ search:
|
||||
|
||||
### Elastic.co
|
||||
|
||||
Elastic Cloud hosted ElasticSearch uses a Cloud ID to determine the instance of
|
||||
hosted ElasticSearch to connect to. Additionally, username and password needs to
|
||||
Elastic Cloud hosted Elasticsearch uses a Cloud ID to determine the instance of
|
||||
hosted Elasticsearch to connect to. Additionally, username and password needs to
|
||||
be provided either directly or using environment variables like defined in
|
||||
[Backstage documentation.](https://backstage.io/docs/conf/writing#includes-and-dynamic-data)
|
||||
|
||||
@@ -217,8 +222,8 @@ search:
|
||||
|
||||
### Others
|
||||
|
||||
Other ElasticSearch instances can be connected to by using standard
|
||||
ElasticSearch authentication methods and exposed URL, provided that the cluster
|
||||
Other Elasticsearch instances can be connected to by using standard
|
||||
Elasticsearch authentication methods and exposed URL, provided that the cluster
|
||||
supports that. The configuration options needed are the URL to the node and
|
||||
authentication information. Authentication can be handled by either providing
|
||||
username/password or an API key. For more information how to create an API key,
|
||||
@@ -248,13 +253,13 @@ search:
|
||||
apiKey: base64EncodedKey
|
||||
```
|
||||
|
||||
### Elastic search batch size
|
||||
### Elasticsearch batch size
|
||||
|
||||
Default batch size of the elastic search engine is set to 1000. If you are using a lower spec computing resources (like AWS small instance),
|
||||
Default batch size of the Elasticsearch engine is set to 1000. If you are using a lower spec computing resources (like AWS small instance),
|
||||
you may get an error caused by limited `thread_pool` configuration. ( `429 Too Many Requests /_bulk` )
|
||||
|
||||
In this case you need to decrease the batch size to index the resources to prevent this kind of error. You can easily decrease
|
||||
or increase the batch size in your `app-config.yaml` using the `batchSize` option provided for elasticsearch configuration.
|
||||
or increase the batch size in your `app-config.yaml` using the `batchSize` option provided for Elasticsearch configuration.
|
||||
|
||||
#### Configuration example
|
||||
|
||||
|
||||
Reference in New Issue
Block a user