Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Console] Autocomplete for index names doesn't work for several indices #163000

Closed
yuliacech opened this issue Aug 2, 2023 · 2 comments · Fixed by #164608
Closed

[Console] Autocomplete for index names doesn't work for several indices #163000

yuliacech opened this issue Aug 2, 2023 · 2 comments · Fixed by #164608
Labels
bug Fixes for quality problems that affect the customer experience Feature:Console Dev Tools Console Feature Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more

Comments

@yuliacech
Copy link
Contributor

Kibana version:
8.9.0
Elasticsearch version:
8.9.0
Server OS version:
Elastic Cloud
Browser version:
Google chrome Version 115.0.5790.114 (Official Build) (arm64)
Browser OS version:
macos m1 Ventura 13.5
Original install method (e.g. download page, yum, from source, etc.):
Elastic Cloud
Describe the bug:
The autocomplete in Console doesn't work for several indices. After the first index name, the user might want to add more index names after a comma. But there is no autocomplete suggestions for any following index names. The suggestions are displayed when a semicolon is used between index names, but this is not allowed by the API.
Steps to reproduce:

  1. Navigate to Dev Tools Console
  2. Type in the following request GET /_cat/indices/ and pick any index name from the suggestions list
  3. Type in a comma and then press option + SPACE (on mac) to display a list of suggestions -> there is nothing shown
  4. Remove the comma and type a semicolon, press option + SPACE to see a list of indices
  5. Send the request to see the error from the API

Expected behavior:
A list of index names is displayed after a comma is typed after the first index name.
Screenshots (if relevant):

Screen.Recording.2023-08-02.at.18.16.35.mov

Errors in browser console (if relevant):

Provide logs and/or server output (if relevant):

Any additional context:

@yuliacech yuliacech added bug Fixes for quality problems that affect the customer experience Feature:Console Dev Tools Console Feature Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more labels Aug 2, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/platform-deployment-management (Team:Deployment Management)

yuliacech added a commit that referenced this issue Aug 4, 2023
## Summary
Fixes #160539

This PR updates the logic for dynamic parameters in the Console
autocomplete engine in preparation for the new script.

#### Changes
- The old script `packages/spec-to-console` contained some logic that
would rename parameters in the json specs: `{index} -> {indices`},
`{node_id} -> {nodes}, {metric} -> {metrics}`. I don't think we need
this anymore because such logic only introduces more hidden mechanics to
the script. There is no significant improvements to autocomplete
suggestions due to these replacements.
- The dynamic parameters defined in the Console autocomplete engine: 
- `indices` - is deleted and only `index` is used instead. Originally,
there was a minor difference between `indices` and `index`: the former
should accept several index names, the latter only 1. [But this logic is
not working for urls currently
anyways](#163000). I don't think
there is a significant improvement for UX to keep this distinction. The
main useful feature of this parameter is to display a list of indices in
the deployment.
- `type` and `types` - deleted because `index mapping types` is a
removed ES feature (see this
[doc](https://www.elastic.co/guide/en/elasticsearch/reference/6.0/removal-of-types.html))
- `id`, `transform_id`, `ids`, `task_id` - deleted as not working. Also
definitions using these parameters don't intend them to be autofilled.
For example, in the url `/_async_search/{id}` the parameter `{id}` can
be any string.
- `user` and `username` - deleted as incorrectly being resolved to a
list of indices. Also definitions using these parameters don't intend
them to be autofilled, for example `_security/user/{username}` when
creating a new user.
  - `node` - delete because it was just an empty list
- `nodes` - deleted because the suggestions of the form `['_local',
'_master', 'data:true', 'data:false', 'master:true', 'master:false']`
are not correct for definitions where a node ID is expected.
- Renamed `variables` to `dynamic parameters` in the Console README
file: I first used the word `variables` in readme for the values defined
in the file
[`kb.js`](https://github.com/elastic/kibana/blob/6e1445b66aae27a9a762ed5632549b3f6a6dfa51/src/plugins/console/public/lib/kb/kb.js).
But then variables support was added to Console and there were several
sections in the readme using the word `variables` for different
concepts. Since in the autocomplete engine code, the function is called
`parametrizedComponentFactories` I think calling these values `dynamic
parameters` makes more sense and avoids confusion.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
crespocarlos pushed a commit to crespocarlos/kibana that referenced this issue Aug 8, 2023
## Summary
Fixes elastic#160539

This PR updates the logic for dynamic parameters in the Console
autocomplete engine in preparation for the new script.

#### Changes
- The old script `packages/spec-to-console` contained some logic that
would rename parameters in the json specs: `{index} -> {indices`},
`{node_id} -> {nodes}, {metric} -> {metrics}`. I don't think we need
this anymore because such logic only introduces more hidden mechanics to
the script. There is no significant improvements to autocomplete
suggestions due to these replacements.
- The dynamic parameters defined in the Console autocomplete engine: 
- `indices` - is deleted and only `index` is used instead. Originally,
there was a minor difference between `indices` and `index`: the former
should accept several index names, the latter only 1. [But this logic is
not working for urls currently
anyways](elastic#163000). I don't think
there is a significant improvement for UX to keep this distinction. The
main useful feature of this parameter is to display a list of indices in
the deployment.
- `type` and `types` - deleted because `index mapping types` is a
removed ES feature (see this
[doc](https://www.elastic.co/guide/en/elasticsearch/reference/6.0/removal-of-types.html))
- `id`, `transform_id`, `ids`, `task_id` - deleted as not working. Also
definitions using these parameters don't intend them to be autofilled.
For example, in the url `/_async_search/{id}` the parameter `{id}` can
be any string.
- `user` and `username` - deleted as incorrectly being resolved to a
list of indices. Also definitions using these parameters don't intend
them to be autofilled, for example `_security/user/{username}` when
creating a new user.
  - `node` - delete because it was just an empty list
- `nodes` - deleted because the suggestions of the form `['_local',
'_master', 'data:true', 'data:false', 'master:true', 'master:false']`
are not correct for definitions where a node ID is expected.
- Renamed `variables` to `dynamic parameters` in the Console README
file: I first used the word `variables` in readme for the values defined
in the file
[`kb.js`](https://github.com/elastic/kibana/blob/6e1445b66aae27a9a762ed5632549b3f6a6dfa51/src/plugins/console/public/lib/kb/kb.js).
But then variables support was added to Console and there were several
sections in the readme using the word `variables` for different
concepts. Since in the autocomplete engine code, the function is called
`parametrizedComponentFactories` I think calling these values `dynamic
parameters` makes more sense and avoids confusion.

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com>
@sakurai-youhei
Copy link
Member

This bug could be fixed by adjusting ret.urlTokenPath HERE; ret.urlTokenPath gets ['_cat', 'indices', ['.kibana']] after typing , (url.comma) but the last ['.kibana'] seems to shrink context.autoCompleteSet.

I will start working on a PR once #163233 will be merged.

sakurai-youhei added a commit to sakurai-youhei/kibana that referenced this issue Aug 23, 2023
sakurai-youhei added a commit that referenced this issue Sep 17, 2023
## Summary

This PR makes autocomplete able to be activated right after `,` (comma).


![autocomplete-on-multi-indices](https://github.com/elastic/kibana/assets/721858/4f3d1530-c5ac-438f-a08a-ef2e4fe57d9c)

Fixes #163000

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [x] Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard accessibility](https://webaim.org/techniques/keyboard/))

### For maintainers

- [x] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

## Release note

Fixes a bug that autocomplete does not work right after a comma.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Feature:Console Dev Tools Console Feature Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants