Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Console] Add autocompletion for data streams (elastic#198507)
Closes elastic#190137 ## Summary This PR adds Console autocompletion for data streams. We use the patterns in the spec definitions to determine what autocomplete entity we should return. For example the `{index}` pattern in the endpoint means we should suggest indices and aliases. This pattern comes directly from the schema in the [Elasticsearch specification repo](https://github.com/elastic/elasticsearch-specification/blob/main/output/schema/schema.json), which is used to generate the Console spec definition. Previously, for the pattern `{index}`, we would only suggest indices and aliases. However, for most of the endpoints where this pattern is used, we should suggest indices, aliases, **and data streams** (see the table below). For example, the [Get Index API](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-index.html) accepts indices, aliases, and data streams as the target, while the spec definition for the `GET /<target>` endpoint uses the `{index}` pattern. In this PR, we make Console also suggest data streams for the `{index}` pattern. List with some endpoints that use the `{index}` pattern: Es API | Endpoint (with link to specs) | Expected target by Es (according to docs) | Data stream compatible? --- | --- | --- | --- [Get index API](https://www.elastic.co/guide/en/elasticsearch/reference/master/indices-get-index.html) | [`GET /<target>`](https://github.com/elastic/kibana/blob/e0838147bddeee43edbcb83ced8d0346f917047c/src/plugins/console/server/lib/spec_definitions/json/generated/indices.get.json#L35) | data streams, indices, and aliases | ✅ [Async Search](https://www.elastic.co/guide/en/elasticsearch/reference/current/async-search.html) | [`POST {index}/_async_search`](https://github.com/elastic/kibana/blob/e0838147bddeee43edbcb83ced8d0346f917047c/src/plugins/console/server/lib/spec_definitions/json/generated/async_search.submit.json#L94) | Not specified | ✅ (tested locally) [Index API](https://www.elastic.co/guide/en/elasticsearch/reference/master/docs-index_.html) | `PUT/POST {index}/_create/{id}` | data stream or index | ✅ [Bulk API](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html) | [`POST/PUT {index}/_bulk`](https://github.com/elastic/kibana/blob/3ac902df8a93d4924996c5cd1584faeeff9be6cb/src/plugins/console/server/lib/spec_definitions/json/generated/bulk.json#L36) | data stream, index, or index alias | ✅ [cat count API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-count.html) | [`GET _cat/count/{index}`](https://github.com/elastic/kibana/blob/3ac902df8a93d4924996c5cd1584faeeff9be6cb/src/plugins/console/server/lib/spec_definitions/json/generated/cat.count.json#L27) | data streams, indices, and aliases | ✅ [cat indices API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-indices.html) | `GET _cat/indices/{index}` | data streams, indices, and aliases | ✅ [cat recovery API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-recovery.html) | `GET _cat/recovery/{index}` | data streams, indices, and aliases | ✅ Note: As discussed with @elastic/devtools-team, it is safe to assume that endpoints with the `{index}` pattern accept data streams, apart from indices and aliases. There are still a few edge cases though, such as alias APIs, which don't accept data streams. Temporarily, it's okay to display data stream suggestions for them, but we could try fixing this in a follow-up PR by utilizing the override specs and adding a pattern for indices and aliases only. Issue: elastic#198588
- Loading branch information