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

[Data Views] Align the namespace parameter with the documentation #140426

Closed
dokmic opened this issue Sep 9, 2022 · 8 comments · Fixed by #155815
Closed

[Data Views] Align the namespace parameter with the documentation #140426

dokmic opened this issue Sep 9, 2022 · 8 comments · Fixed by #155815
Assignees
Labels
bug Fixes for quality problems that affect the customer experience :DataDiscovery/fix-it-week Feature:Data Views Data Views code and UI - index patterns before 8.0 impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL.

Comments

@dokmic
Copy link
Contributor

dokmic commented Sep 9, 2022

Currently, the namespace parameter in the data view create API is not taken into account. In the code, it is some sort of a read-only parameter.

We should either update the documentation or fix that in the code.

@dokmic dokmic added bug Fixes for quality problems that affect the customer experience Feature:Data Views Data Views code and UI - index patterns before 8.0 Team:AppServicesSv labels Sep 9, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServicesSv)

@tsullivan
Copy link
Member

tsullivan commented Sep 9, 2022

As a workaround, you can call the create data view API using a URL path under a space name:

curl -X POST /s/my-space-name/api/data_views/data_view
{ "data_view": {} }


But this does not give you the ability to create the data view in multiple spaces.

@exalate-issue-sync exalate-issue-sync bot added the impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. label Sep 12, 2022
@AndrewMcQuerry
Copy link

AndrewMcQuerry commented Sep 23, 2022

Does this imply that there is no current method for being able to create or update a Data View via API and have it associated with multiple spaces?

I ask because I don't seem to be able to define namespaces when creating or updating a data_view via API.

POST kbn:/api/data_views/data_view
{
  "data_view": {
    "id": "default_index_pattern",
    "name": "default_index_pattern",
    "title": "default_index_pattern",
    "namespaces": ["default"]
  }
}
{
  "statusCode": 400,
  "error": "Bad Request",
  "message": "[request body.data_view.namespaces]: definition for this key is missing"
}

@alemansec
Copy link

indeed, as an end-user relying solely on api to deploy and configure my clusters and kibana instances, i ran into this (i submitted the issue to support.elastic.co leading to this github issue),

it also prevents me from having the same ID for data views over multiple spaces (because of the conflicting objects response), feature we were previously using with versions < 8 to edit/validate dashboards on a given space, later copying them unchanged to the spaces exposed/used by our customers.

@petrklapka petrklapka added Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. and removed Team:AppServicesSv labels Nov 28, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@orsius
Copy link

orsius commented Mar 29, 2023

Dear all, is anyone is aware of any developments on this topic?

Currently, the namespace parameter in the data view create API is not taken into account. In the code, it is some sort of a read-only parameter.

We should either update the documentation or fix that in the code.

Waiting for you feedback,
kr,

ps: I recently open a similar topics under: https://discuss.elastic.co/t/kibana-api-data-view-not-working-as-expected-with-namespaces-parameter/327168

@AndrewMcQuerry
Copy link

I'd like to bump this and reiterate that in an Enterprise environment, with many Kibana Spaces and many "standard" Data Views, it is extremely important that we have the ability to manage Data Views (and the namespace(s) they are shared with) from the Kibana API.

@davismcphee davismcphee self-assigned this Apr 25, 2023
davismcphee added a commit that referenced this issue May 8, 2023
)

## Summary

This work was originally done by @jughosta in #150712, I just added a
couple of integration tests and opened another PR for it.

Fixes #140426.

#### Original PR summary:

This PR adds support for `namespaces` param in create data view API as
per docs
https://www.elastic.co/guide/en/kibana/current/data-views-api-create.html#data-views-api-properties

<img width="300" alt="Screenshot 2023-02-09 at 15 04 55"
src="https://user-images.githubusercontent.com/1415710/217835577-fa4286ff-89f4-4de2-97b0-62c04f756858.png">

Previous functionality is still in place:
* setting "default" space if "namespaces" param is not provided
<img width="300" alt="Screenshot 2023-02-09 at 15 06 55"
src="https://user-images.githubusercontent.com/1415710/217835951-d274c8ba-5bd9-4c36-9487-c2dbd5ce42de.png">

* setting the specified in URL space ID if "namespaces" param is not
provided
<img width="300" alt="Screenshot 2023-02-09 at 15 06 34"
src="https://user-images.githubusercontent.com/1415710/217836019-81f36a16-157f-4ce9-9d19-c5685d633acc.png">

### Checklist

- [ ] ~Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)~
- [ ]
~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials~
- [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
- [ ] ~Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard
accessibility](https://webaim.org/techniques/keyboard/))~
- [ ] ~Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))~
- [ ] ~If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~
- [ ] ~This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))~
- [ ] ~This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)~

### For maintainers

- [ ] 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)

---------

Co-authored-by: Julia Rechkunova <julia.rechkunova@elastic.co>
kibanamachine pushed a commit to kibanamachine/kibana that referenced this issue May 8, 2023
…tic#155815)

## Summary

This work was originally done by @jughosta in elastic#150712, I just added a
couple of integration tests and opened another PR for it.

Fixes elastic#140426.

#### Original PR summary:

This PR adds support for `namespaces` param in create data view API as
per docs
https://www.elastic.co/guide/en/kibana/current/data-views-api-create.html#data-views-api-properties

<img width="300" alt="Screenshot 2023-02-09 at 15 04 55"
src="https://user-images.githubusercontent.com/1415710/217835577-fa4286ff-89f4-4de2-97b0-62c04f756858.png">

Previous functionality is still in place:
* setting "default" space if "namespaces" param is not provided
<img width="300" alt="Screenshot 2023-02-09 at 15 06 55"
src="https://user-images.githubusercontent.com/1415710/217835951-d274c8ba-5bd9-4c36-9487-c2dbd5ce42de.png">

* setting the specified in URL space ID if "namespaces" param is not
provided
<img width="300" alt="Screenshot 2023-02-09 at 15 06 34"
src="https://user-images.githubusercontent.com/1415710/217836019-81f36a16-157f-4ce9-9d19-c5685d633acc.png">

### Checklist

- [ ] ~Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)~
- [ ]
~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials~
- [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
- [ ] ~Any UI touched in this PR is usable by keyboard only (learn more
about [keyboard
accessibility](https://webaim.org/techniques/keyboard/))~
- [ ] ~Any UI touched in this PR does not create any new axe failures
(run axe in browser:
[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),
[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))~
- [ ] ~If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~
- [ ] ~This renders correctly on smaller devices using a responsive
layout. (You can test this [in your
browser](https://www.browserstack.com/guide/responsive-testing-on-local-server))~
- [ ] ~This was checked for [cross-browser
compatibility](https://www.elastic.co/support/matrix#matrix_browsers)~

### For maintainers

- [ ] 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)

---------

Co-authored-by: Julia Rechkunova <julia.rechkunova@elastic.co>
(cherry picked from commit ab2f967)
@davismcphee
Copy link
Contributor

Just wanted to share an update that this issue has now been addressed in #155815, and the create data view API now considers the namespaces parameter as expected. While we don't have any plans to support namespaces in the update API, we already have an existing API that can do this called _update_objects_spaces. Thanks all for the input!

kibanamachine added a commit that referenced this issue May 8, 2023
…#155815) (#156991)

# Backport

This will backport the following commits from `main` to `8.8`:
- [[Data Views] Support "namespaces" param in create data view API
(#155815)](#155815)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Davis
McPhee","email":"davis.mcphee@elastic.co"},"sourceCommit":{"committedDate":"2023-05-08T13:03:08Z","message":"[Data
Views] Support \"namespaces\" param in create data view API
(#155815)\n\n## Summary\r\n\r\nThis work was originally done by
@jughosta in #150712, I just added a\r\ncouple of integration tests and
opened another PR for it.\r\n\r\nFixes #140426.\r\n\r\n#### Original PR
summary:\r\n\r\nThis PR adds support for `namespaces` param in create
data view API as\r\nper
docs\r\nhttps://www.elastic.co/guide/en/kibana/current/data-views-api-create.html#data-views-api-properties\r\n\r\n<img
width=\"300\" alt=\"Screenshot 2023-02-09 at 15 04
55\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/217835577-fa4286ff-89f4-4de2-97b0-62c04f756858.png\">\r\n\r\nPrevious
functionality is still in place:\r\n* setting \"default\" space if
\"namespaces\" param is not provided\r\n<img width=\"300\"
alt=\"Screenshot 2023-02-09 at 15 06
55\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/217835951-d274c8ba-5bd9-4c36-9487-c2dbd5ce42de.png\">\r\n\r\n*
setting the specified in URL space ID if \"namespaces\" param is
not\r\nprovided\r\n<img width=\"300\" alt=\"Screenshot 2023-02-09 at 15
06
34\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/217836019-81f36a16-157f-4ce9-9d19-c5685d633acc.png\">\r\n\r\n###
Checklist\r\n\r\n- [ ] ~Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)~\r\n-
[
]\r\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials~\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] ~Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard\r\naccessibility](https://webaim.org/techniques/keyboard/))~\r\n-
[ ] ~Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))~\r\n-
[ ] ~If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\r\n-
[ ] ~This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))~\r\n-
[ ] ~This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)~\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Julia Rechkunova
<julia.rechkunova@elastic.co>","sha":"ab2f967ba5720daffa8d404802effe688804d41c","branchLabelMapping":{"^v8.9.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Data
Views","Team:DataDiscovery","v8.8.0","v8.9.0"],"number":155815,"url":"https://github.com/elastic/kibana/pull/155815","mergeCommit":{"message":"[Data
Views] Support \"namespaces\" param in create data view API
(#155815)\n\n## Summary\r\n\r\nThis work was originally done by
@jughosta in #150712, I just added a\r\ncouple of integration tests and
opened another PR for it.\r\n\r\nFixes #140426.\r\n\r\n#### Original PR
summary:\r\n\r\nThis PR adds support for `namespaces` param in create
data view API as\r\nper
docs\r\nhttps://www.elastic.co/guide/en/kibana/current/data-views-api-create.html#data-views-api-properties\r\n\r\n<img
width=\"300\" alt=\"Screenshot 2023-02-09 at 15 04
55\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/217835577-fa4286ff-89f4-4de2-97b0-62c04f756858.png\">\r\n\r\nPrevious
functionality is still in place:\r\n* setting \"default\" space if
\"namespaces\" param is not provided\r\n<img width=\"300\"
alt=\"Screenshot 2023-02-09 at 15 06
55\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/217835951-d274c8ba-5bd9-4c36-9487-c2dbd5ce42de.png\">\r\n\r\n*
setting the specified in URL space ID if \"namespaces\" param is
not\r\nprovided\r\n<img width=\"300\" alt=\"Screenshot 2023-02-09 at 15
06
34\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/217836019-81f36a16-157f-4ce9-9d19-c5685d633acc.png\">\r\n\r\n###
Checklist\r\n\r\n- [ ] ~Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)~\r\n-
[
]\r\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials~\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] ~Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard\r\naccessibility](https://webaim.org/techniques/keyboard/))~\r\n-
[ ] ~Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))~\r\n-
[ ] ~If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\r\n-
[ ] ~This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))~\r\n-
[ ] ~This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)~\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Julia Rechkunova
<julia.rechkunova@elastic.co>","sha":"ab2f967ba5720daffa8d404802effe688804d41c"}},"sourceBranch":"main","suggestedTargetBranches":["8.8"],"targetPullRequestStates":[{"branch":"8.8","label":"v8.8.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.9.0","labelRegex":"^v8.9.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/155815","number":155815,"mergeCommit":{"message":"[Data
Views] Support \"namespaces\" param in create data view API
(#155815)\n\n## Summary\r\n\r\nThis work was originally done by
@jughosta in #150712, I just added a\r\ncouple of integration tests and
opened another PR for it.\r\n\r\nFixes #140426.\r\n\r\n#### Original PR
summary:\r\n\r\nThis PR adds support for `namespaces` param in create
data view API as\r\nper
docs\r\nhttps://www.elastic.co/guide/en/kibana/current/data-views-api-create.html#data-views-api-properties\r\n\r\n<img
width=\"300\" alt=\"Screenshot 2023-02-09 at 15 04
55\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/217835577-fa4286ff-89f4-4de2-97b0-62c04f756858.png\">\r\n\r\nPrevious
functionality is still in place:\r\n* setting \"default\" space if
\"namespaces\" param is not provided\r\n<img width=\"300\"
alt=\"Screenshot 2023-02-09 at 15 06
55\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/217835951-d274c8ba-5bd9-4c36-9487-c2dbd5ce42de.png\">\r\n\r\n*
setting the specified in URL space ID if \"namespaces\" param is
not\r\nprovided\r\n<img width=\"300\" alt=\"Screenshot 2023-02-09 at 15
06
34\"\r\nsrc=\"https://user-images.githubusercontent.com/1415710/217836019-81f36a16-157f-4ce9-9d19-c5685d633acc.png\">\r\n\r\n###
Checklist\r\n\r\n- [ ] ~Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)~\r\n-
[
]\r\n~[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials~\r\n- [x] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] ~Any UI
touched in this PR is usable by keyboard only (learn more\r\nabout
[keyboard\r\naccessibility](https://webaim.org/techniques/keyboard/))~\r\n-
[ ] ~Any UI touched in this PR does not create any new axe
failures\r\n(run axe in
browser:\r\n[FF](https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/),\r\n[Chrome](https://chrome.google.com/webstore/detail/axe-web-accessibility-tes/lhdoppojpmngadmnindnejefpokejbdd?hl=en-US))~\r\n-
[ ] ~If a plugin configuration key changed, check if it needs to
be\r\nallowlisted in the cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)~\r\n-
[ ] ~This renders correctly on smaller devices using a
responsive\r\nlayout. (You can test this [in
your\r\nbrowser](https://www.browserstack.com/guide/responsive-testing-on-local-server))~\r\n-
[ ] ~This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)~\r\n\r\n###
For maintainers\r\n\r\n- [ ] This was checked for breaking API changes
and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n---------\r\n\r\nCo-authored-by:
Julia Rechkunova
<julia.rechkunova@elastic.co>","sha":"ab2f967ba5720daffa8d404802effe688804d41c"}}]}]
BACKPORT-->

Co-authored-by: Davis McPhee <davis.mcphee@elastic.co>
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 :DataDiscovery/fix-it-week Feature:Data Views Data Views code and UI - index patterns before 8.0 impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL.
Projects
None yet
10 participants