Commit graph

227 commits

Author SHA1 Message Date
Kibana Machine
d3853f4789
[8.16] [SO migration] Move to previous step in update mappings wait when it fails with search_phase_execution_exception (#216693) (#217190)
# Backport

This will backport the following commits from `main` to `8.16`:
- [[SO migration] Move to previous step in update mappings wait when it
fails with search_phase_execution_exception
(#216693)](https://github.com/elastic/kibana/pull/216693)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Jesus
Wahrman","email":"41008968+jesuswr@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-04T13:37:06Z","message":"[SO
migration] Move to previous step in update mappings wait when it fails
with search_phase_execution_exception (#216693)\n\n##
Summary\n\nResolves
https://github.com/elastic/kibana/issues/207096\n\nThis continues the
work in https://github.com/elastic/kibana/pull/213979\n\nSometimes ES
returns a 200 response containing an error field when we\nwait for the
update mappings task. This case wasn't being handled. This\nPR handles
that case, when we find a `search_phase_execution_exception`\nin the ES
response we return a retryable error that sends us back to the\nupdate
mappings state. It does it for both migration algorithms, the\npriority
is ZDT but seemed like a nice to have in both.\n\n### Checklist\n\nCheck
the PR satisfies following conditions. \n\nReviewers should verify this
PR satisfies this list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"49380143432b654cf1b849d8c77b3abc2fb3aeb4","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","backport:prev-major","backport:current-major","v9.1.0"],"title":"[SO
migration] Move to previous step in update mappings wait when it fails
with
search_phase_execution_exception","number":216693,"url":"https://github.com/elastic/kibana/pull/216693","mergeCommit":{"message":"[SO
migration] Move to previous step in update mappings wait when it fails
with search_phase_execution_exception (#216693)\n\n##
Summary\n\nResolves
https://github.com/elastic/kibana/issues/207096\n\nThis continues the
work in https://github.com/elastic/kibana/pull/213979\n\nSometimes ES
returns a 200 response containing an error field when we\nwait for the
update mappings task. This case wasn't being handled. This\nPR handles
that case, when we find a `search_phase_execution_exception`\nin the ES
response we return a retryable error that sends us back to the\nupdate
mappings state. It does it for both migration algorithms, the\npriority
is ZDT but seemed like a nice to have in both.\n\n### Checklist\n\nCheck
the PR satisfies following conditions. \n\nReviewers should verify this
PR satisfies this list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"49380143432b654cf1b849d8c77b3abc2fb3aeb4"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/216693","number":216693,"mergeCommit":{"message":"[SO
migration] Move to previous step in update mappings wait when it fails
with search_phase_execution_exception (#216693)\n\n##
Summary\n\nResolves
https://github.com/elastic/kibana/issues/207096\n\nThis continues the
work in https://github.com/elastic/kibana/pull/213979\n\nSometimes ES
returns a 200 response containing an error field when we\nwait for the
update mappings task. This case wasn't being handled. This\nPR handles
that case, when we find a `search_phase_execution_exception`\nin the ES
response we return a retryable error that sends us back to the\nupdate
mappings state. It does it for both migration algorithms, the\npriority
is ZDT but seemed like a nice to have in both.\n\n### Checklist\n\nCheck
the PR satisfies following conditions. \n\nReviewers should verify this
PR satisfies this list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"49380143432b654cf1b849d8c77b3abc2fb3aeb4"}}]}]
BACKPORT-->

Co-authored-by: Jesus Wahrman <41008968+jesuswr@users.noreply.github.com>
2025-04-04 16:44:48 +01:00
Kibana Machine
e1b00ef925
[8.16] Zdt retry on common failures (#213979) (#214068)
# Backport

This will backport the following commits from `main` to `8.16`:
- [Zdt retry on common failures
(#213979)](https://github.com/elastic/kibana/pull/213979)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Jesus
Wahrman","email":"41008968+jesuswr@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-03-12T09:10:47Z","message":"Zdt
retry on common failures (#213979)\n\n## Summary\n\nresolves
https://github.com/elastic/kibana/issues/207096\n\nAdded a new handler
to `readWithPit`, `pickupUpdatedMappings` and\n`checkForUnknownDocs`.
This handler retries when it receives an error\nresponse including
`type: search_phase_execution_exception`.\n\n\n### Checklist\n\nCheck
the PR satisfies following conditions. \n\nReviewers should verify this
PR satisfies this list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"68b2bde0b032efb2fab3e8a30a7d5a9e0b601f7e","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Saved
Objects","release_note:skip","backport:prev-major","Epic:ZDTmigrations","v9.1.0"],"title":"Zdt
retry on common
failures","number":213979,"url":"https://github.com/elastic/kibana/pull/213979","mergeCommit":{"message":"Zdt
retry on common failures (#213979)\n\n## Summary\n\nresolves
https://github.com/elastic/kibana/issues/207096\n\nAdded a new handler
to `readWithPit`, `pickupUpdatedMappings` and\n`checkForUnknownDocs`.
This handler retries when it receives an error\nresponse including
`type: search_phase_execution_exception`.\n\n\n### Checklist\n\nCheck
the PR satisfies following conditions. \n\nReviewers should verify this
PR satisfies this list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"68b2bde0b032efb2fab3e8a30a7d5a9e0b601f7e"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/213979","number":213979,"mergeCommit":{"message":"Zdt
retry on common failures (#213979)\n\n## Summary\n\nresolves
https://github.com/elastic/kibana/issues/207096\n\nAdded a new handler
to `readWithPit`, `pickupUpdatedMappings` and\n`checkForUnknownDocs`.
This handler retries when it receives an error\nresponse including
`type: search_phase_execution_exception`.\n\n\n### Checklist\n\nCheck
the PR satisfies following conditions. \n\nReviewers should verify this
PR satisfies this list as well.\n\n- [x] [Unit or
functional\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\nwere
updated or added to match the most common scenarios\n- [x] The PR
description includes the appropriate Release Notes section,\nand the
correct `release_note:*` label is applied per
the\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)","sha":"68b2bde0b032efb2fab3e8a30a7d5a9e0b601f7e"}}]}]
BACKPORT-->

Co-authored-by: Jesus Wahrman <41008968+jesuswr@users.noreply.github.com>
2025-03-12 13:54:30 +01:00
Jesus Wahrman
c4d00b378c
[8.16] [docs] Remove experimental message from saved objects import and export apis (#202173) (#202457)
# Backport

This will backport the following commits from `main` to `8.16`:
- [[docs] Remove experimental message from saved objects import and
export apis (#202173)](https://github.com/elastic/kibana/pull/202173)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Jesus
Wahrman","email":"41008968+jesuswr@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-12-02T11:05:52Z","message":"[docs]
Remove experimental message from saved objects import and export apis
(#202173)\n\n## Summary\r\n\r\nresolves
https://github.com/elastic/kibana/issues/159454\r\n\r\nRemove
experimental message from saved objects import and export
apis.\r\n\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following
conditions. \r\n\r\nReviewers should verify this PR satisfies this list
as well.\r\n\r\n-
[x]\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\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"9b99070470869ba390924cf64745771b6b143377","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","docs","backport:version","v8.17.0","v8.18.0","v8.16.2","v8.15.6"],"title":"[docs]
Remove experimental message from saved objects import and export
apis","number":202173,"url":"https://github.com/elastic/kibana/pull/202173","mergeCommit":{"message":"[docs]
Remove experimental message from saved objects import and export apis
(#202173)\n\n## Summary\r\n\r\nresolves
https://github.com/elastic/kibana/issues/159454\r\n\r\nRemove
experimental message from saved objects import and export
apis.\r\n\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following
conditions. \r\n\r\nReviewers should verify this PR satisfies this list
as well.\r\n\r\n-
[x]\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\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"9b99070470869ba390924cf64745771b6b143377"}},"sourceBranch":"main","suggestedTargetBranches":["8.17","8.x","8.16","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202173","number":202173,"mergeCommit":{"message":"[docs]
Remove experimental message from saved objects import and export apis
(#202173)\n\n## Summary\r\n\r\nresolves
https://github.com/elastic/kibana/issues/159454\r\n\r\nRemove
experimental message from saved objects import and export
apis.\r\n\r\n\r\n### Checklist\r\n\r\nCheck the PR satisfies following
conditions. \r\n\r\nReviewers should verify this PR satisfies this list
as well.\r\n\r\n-
[x]\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\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"9b99070470869ba390924cf64745771b6b143377"}},{"branch":"8.17","label":"v8.17.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.6","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
2024-12-02 09:18:33 -06:00
Kibana Machine
d5a062e518
[8.16] Fix issue with duplicate references in error object when copying saved objects to space (#200053) (#200600)
# Backport

This will backport the following commits from `main` to `8.16`:
- [Fix issue with duplicate references in error object when copying
saved objects to space
(#200053)](https://github.com/elastic/kibana/pull/200053)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT
[{"author":{"name":"Sid","email":"siddharthmantri1@gmail.com"},"sourceCommit":{"committedDate":"2024-11-18T15:46:07Z","message":"Fix
issue with duplicate references in error object when copying saved
objects to space (#200053)\n\nCloses
https://github.com/elastic/kibana/issues/158027\r\n\r\n##
Summary\r\n\r\nSimply dedupes references to objects if they are part of
the\r\nmissing_references in the copy saved objects to SO
endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for
loop since we had a couple of\r\nearly exit scenarios\r\n- Checks
against the set for references already added to the missing\r\nlist and
adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the
duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot
2024-11-14 at 01 52
54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New
response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01
50
41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n###
Release note\r\nDedupe results from copy saved objects to spaces API
when object\r\ncontains references to other
objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:fix","Team:Security","Feature:Saved
Objects","v9.0.0","backport:prev-minor","backport:prev-major","v8.17.0"],"title":"Fix
issue with duplicate references in error object when copying saved
objects to
space","number":200053,"url":"https://github.com/elastic/kibana/pull/200053","mergeCommit":{"message":"Fix
issue with duplicate references in error object when copying saved
objects to space (#200053)\n\nCloses
https://github.com/elastic/kibana/issues/158027\r\n\r\n##
Summary\r\n\r\nSimply dedupes references to objects if they are part of
the\r\nmissing_references in the copy saved objects to SO
endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for
loop since we had a couple of\r\nearly exit scenarios\r\n- Checks
against the set for references already added to the missing\r\nlist and
adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the
duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot
2024-11-14 at 01 52
54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New
response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01
50
41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n###
Release note\r\nDedupe results from copy saved objects to spaces API
when object\r\ncontains references to other
objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200053","number":200053,"mergeCommit":{"message":"Fix
issue with duplicate references in error object when copying saved
objects to space (#200053)\n\nCloses
https://github.com/elastic/kibana/issues/158027\r\n\r\n##
Summary\r\n\r\nSimply dedupes references to objects if they are part of
the\r\nmissing_references in the copy saved objects to SO
endpoint\r\n\r\n### Notes\r\n- Update forEach over SOs to a regular for
loop since we had a couple of\r\nearly exit scenarios\r\n- Checks
against the set for references already added to the missing\r\nlist and
adds only if not present\r\n\r\n------\r\n\r\n**Old response: Note the
duplicate references**\r\n\r\n<img width=\"400\" alt=\"Screenshot
2024-11-14 at 01 52
54\"\r\nsrc=\"https://github.com/user-attachments/assets/67078080-e39d-43b2-bf7c-7abb76866fa4\">\r\n\r\n\r\n**New
response**\r\n\r\n<img width=\"800\" alt=\"Screenshot 2024-11-14 at 01
50
41\"\r\nsrc=\"https://github.com/user-attachments/assets/776db189-af8c-4522-bb03-f8efbb7cdcd9\">\r\n\r\n\r\n###
Release note\r\nDedupe results from copy saved objects to spaces API
when object\r\ncontains references to other
objects.\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"262b48f1cf4d4f624be99c2f42d169e4ab1f1f44"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Sid <siddharthmantri1@gmail.com>
2024-11-18 11:38:07 -06:00
Kibana Machine
10abaaaf5c
[8.16] Use more efficient strategies to process user input (#196858) (#197791)
# Backport

This will backport the following commits from `main` to `8.16`:
- [Use more efficient strategies to process user input
(#196858)](https://github.com/elastic/kibana/pull/196858)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2024-10-22T12:07:25Z","message":"Use
more efficient strategies to process user input (#196858)\n\n##
Summary\r\n\r\nAddress performance concerns with
Regexps","sha":"c9637cf71c97e2290db57302d54b90caffb6b1bf","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","backport:all-open"],"title":"Use
more efficient strategies to process user
input","number":196858,"url":"https://github.com/elastic/kibana/pull/196858","mergeCommit":{"message":"Use
more efficient strategies to process user input (#196858)\n\n##
Summary\r\n\r\nAddress performance concerns with
Regexps","sha":"c9637cf71c97e2290db57302d54b90caffb6b1bf"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196858","number":196858,"mergeCommit":{"message":"Use
more efficient strategies to process user input (#196858)\n\n##
Summary\r\n\r\nAddress performance concerns with
Regexps","sha":"c9637cf71c97e2290db57302d54b90caffb6b1bf"}}]}]
BACKPORT-->

Co-authored-by: Gerard Soldevila <gerard.soldevila@elastic.co>
2024-10-25 06:54:10 -05:00
Kibana Machine
3687435cb4
[8.16] Update mappings if/when new SO types are introduced (#197061) (#197573)
# Backport

This will backport the following commits from `main` to `8.16`:
- [Update mappings if/when new SO types are introduced
(#197061)](https://github.com/elastic/kibana/pull/197061)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2024-10-24T08:21:43Z","message":"Update
mappings if/when new SO types are introduced (#197061)\n\n##
Summary\r\n\r\nAddresses
https://github.com/elastic/elastic-entity-model/issues/70\r\nFixes
regression introduced
in\r\nhttps://github.com/elastic/kibana/pull/176803","sha":"8de3636e43be7c874b2c3457f1496a0fc31f224d","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","Team:Core","release_note:skip","v9.0.0","backport:prev-minor","backport:prev-major","v8.16.0","v8.15.3"],"title":"Update
mappings if/when new SO types are
introduced","number":197061,"url":"https://github.com/elastic/kibana/pull/197061","mergeCommit":{"message":"Update
mappings if/when new SO types are introduced (#197061)\n\n##
Summary\r\n\r\nAddresses
https://github.com/elastic/elastic-entity-model/issues/70\r\nFixes
regression introduced
in\r\nhttps://github.com/elastic/kibana/pull/176803","sha":"8de3636e43be7c874b2c3457f1496a0fc31f224d"}},"sourceBranch":"main","suggestedTargetBranches":["8.16","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/197061","number":197061,"mergeCommit":{"message":"Update
mappings if/when new SO types are introduced (#197061)\n\n##
Summary\r\n\r\nAddresses
https://github.com/elastic/elastic-entity-model/issues/70\r\nFixes
regression introduced
in\r\nhttps://github.com/elastic/kibana/pull/176803","sha":"8de3636e43be7c874b2c3457f1496a0fc31f224d"}},{"branch":"8.16","label":"v8.16.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Gerard Soldevila <gerard.soldevila@elastic.co>
2024-10-24 05:11:52 -05:00
Kibana Machine
0bdfdbfbf0
[8.x] Add logging to importer. Closes issue #192212 (#192234) (#195339)
# Backport

This will backport the following commits from `main` to `8.x`:
- [Add logging to importer. Closes issue #192212
(#192234)](https://github.com/elastic/kibana/pull/192234)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Kyra
Cho","email":"wsc2119@columbia.edu"},"sourceCommit":{"committedDate":"2024-10-08T01:58:32Z","message":"Add
logging to importer. Closes issue #192212 (#192234)\n\n##
Summary\r\nHello, this closes issue #192212 by adding a custom logger to
the\r\nimporter, making debugging issues easier.\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [N/A] 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-
[N/A]\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 TODO\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed TODO\r\n- [N/A] Any UI touched in this
PR is usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [N/A] 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-
[N/A] 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-
[N/A] 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-
[N/A] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n###
For maintainers\r\n\r\n- [X] 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(no
API changes)\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"c36a8943982b92afd593a521d5a0bf2de06deb01","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","💝community","v9.0.0","backport:prev-minor","v8.16.0"],"title":"Add
logging to importer. Closes issue
#192212","number":192234,"url":"https://github.com/elastic/kibana/pull/192234","mergeCommit":{"message":"Add
logging to importer. Closes issue #192212 (#192234)\n\n##
Summary\r\nHello, this closes issue #192212 by adding a custom logger to
the\r\nimporter, making debugging issues easier.\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [N/A] 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-
[N/A]\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 TODO\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed TODO\r\n- [N/A] Any UI touched in this
PR is usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [N/A] 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-
[N/A] 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-
[N/A] 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-
[N/A] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n###
For maintainers\r\n\r\n- [X] 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(no
API changes)\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"c36a8943982b92afd593a521d5a0bf2de06deb01"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192234","number":192234,"mergeCommit":{"message":"Add
logging to importer. Closes issue #192212 (#192234)\n\n##
Summary\r\nHello, this closes issue #192212 by adding a custom logger to
the\r\nimporter, making debugging issues easier.\r\n###
Checklist\r\n\r\nDelete any items that are not applicable to this
PR.\r\n\r\n- [N/A] 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-
[N/A]\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 TODO\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed TODO\r\n- [N/A] Any UI touched in this
PR is usable by keyboard only (learn more\r\nabout [keyboard
accessibility](https://webaim.org/techniques/keyboard/))\r\n- [N/A] 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-
[N/A] 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-
[N/A] 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-
[N/A] This was checked for
[cross-browser\r\ncompatibility](https://www.elastic.co/support/matrix#matrix_browsers)\r\n\r\n\r\n###
For maintainers\r\n\r\n- [X] 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(no
API changes)\r\n\r\n---------\r\n\r\nCo-authored-by: Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"c36a8943982b92afd593a521d5a0bf2de06deb01"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Kyra Cho <wsc2119@columbia.edu>
2024-10-08 05:43:17 +02:00
Gerard Soldevila
c7b29d18dd
[8.x] [Migrations] Backport ALL updates to integration tests (#194013)
# Backport

This will backport the following PRs from `main` to `8.x`:
 - https://github.com/elastic/kibana/pull/193328
 - https://github.com/elastic/kibana/pull/193856
 - https://github.com/elastic/kibana/pull/193696
 - https://github.com/elastic/kibana/pull/194151
2024-09-27 10:06:10 +02:00
Kibana Machine
3cab9c24f7
[8.x] [HTTP] Set explicit access for &#x60;public&#x60; HTTP APIs (#192554) (#193735)
# Backport

This will backport the following commits from `main` to `8.x`:
- [[HTTP] Set explicit access for &#x60;public&#x60; HTTP APIs
(#192554)](https://github.com/elastic/kibana/pull/192554)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Jean-Louis
Leysens","email":"jeanlouis.leysens@elastic.co"},"sourceCommit":{"committedDate":"2024-09-23T14:53:31Z","message":"[HTTP]
Set explicit access for `public` HTTP APIs (#192554)\n\n##
Summary\r\n\r\nWe will be enforcing restricted access to internal HTTP
APIs [from\r\n9.0](https://github.com/elastic/kibana/issues/186781).
This PR is part 1\r\nof audit checking that our public APIs have their
access tag set\r\nexplicitly to ensure they are still available to end
users after we\r\nstart enforcing HTTP API restrictions. APIs reviewed
in this
PR\r\n([docs](https://www.elastic.co/guide/en/kibana/current/dashboard-import-api.html)):\r\n\r\n<img
width=\"260\" alt=\"Screenshot 2024-09-11 at 11 25
55\"\r\nsrc=\"https://github.com/user-attachments/assets/499b1f1f-8e01-4463-9410-4500e438cd23\">\r\n\r\n##
Note to reviewers\r\n\r\nThis audit is focussed on set `access:
'public'` where needed. Per the\r\nscreenshot our public-facing
documentation is taken as the source of\r\ntruth for which APIs should
be public. This may differ per offering so\r\nplease consider whether a
given HTTP API should be public on both\r\nserverless and stateful
offerings.\r\n\r\n## Risks\r\n\r\n* If we miss an API that should be
public, end users will encounter a\r\n`400` response when they try to
use the HTTP API on 9.0\r\n* If we set an API's access to \"public\" it
will not have the same\r\nrestrictions applied to
it.","sha":"3fa5bdf8732101812a656ec954e2a8d779838938","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:http","Team:Core","release_note:skip","v9.0.0","v8.16.0","backport:version"],"title":"[HTTP]
Set explicit access for `public` HTTP
APIs","number":192554,"url":"https://github.com/elastic/kibana/pull/192554","mergeCommit":{"message":"[HTTP]
Set explicit access for `public` HTTP APIs (#192554)\n\n##
Summary\r\n\r\nWe will be enforcing restricted access to internal HTTP
APIs [from\r\n9.0](https://github.com/elastic/kibana/issues/186781).
This PR is part 1\r\nof audit checking that our public APIs have their
access tag set\r\nexplicitly to ensure they are still available to end
users after we\r\nstart enforcing HTTP API restrictions. APIs reviewed
in this
PR\r\n([docs](https://www.elastic.co/guide/en/kibana/current/dashboard-import-api.html)):\r\n\r\n<img
width=\"260\" alt=\"Screenshot 2024-09-11 at 11 25
55\"\r\nsrc=\"https://github.com/user-attachments/assets/499b1f1f-8e01-4463-9410-4500e438cd23\">\r\n\r\n##
Note to reviewers\r\n\r\nThis audit is focussed on set `access:
'public'` where needed. Per the\r\nscreenshot our public-facing
documentation is taken as the source of\r\ntruth for which APIs should
be public. This may differ per offering so\r\nplease consider whether a
given HTTP API should be public on both\r\nserverless and stateful
offerings.\r\n\r\n## Risks\r\n\r\n* If we miss an API that should be
public, end users will encounter a\r\n`400` response when they try to
use the HTTP API on 9.0\r\n* If we set an API's access to \"public\" it
will not have the same\r\nrestrictions applied to
it.","sha":"3fa5bdf8732101812a656ec954e2a8d779838938"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/192554","number":192554,"mergeCommit":{"message":"[HTTP]
Set explicit access for `public` HTTP APIs (#192554)\n\n##
Summary\r\n\r\nWe will be enforcing restricted access to internal HTTP
APIs [from\r\n9.0](https://github.com/elastic/kibana/issues/186781).
This PR is part 1\r\nof audit checking that our public APIs have their
access tag set\r\nexplicitly to ensure they are still available to end
users after we\r\nstart enforcing HTTP API restrictions. APIs reviewed
in this
PR\r\n([docs](https://www.elastic.co/guide/en/kibana/current/dashboard-import-api.html)):\r\n\r\n<img
width=\"260\" alt=\"Screenshot 2024-09-11 at 11 25
55\"\r\nsrc=\"https://github.com/user-attachments/assets/499b1f1f-8e01-4463-9410-4500e438cd23\">\r\n\r\n##
Note to reviewers\r\n\r\nThis audit is focussed on set `access:
'public'` where needed. Per the\r\nscreenshot our public-facing
documentation is taken as the source of\r\ntruth for which APIs should
be public. This may differ per offering so\r\nplease consider whether a
given HTTP API should be public on both\r\nserverless and stateful
offerings.\r\n\r\n## Risks\r\n\r\n* If we miss an API that should be
public, end users will encounter a\r\n`400` response when they try to
use the HTTP API on 9.0\r\n* If we set an API's access to \"public\" it
will not have the same\r\nrestrictions applied to
it.","sha":"3fa5bdf8732101812a656ec954e2a8d779838938"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Jean-Louis Leysens <jeanlouis.leysens@elastic.co>
2024-09-23 11:49:45 -05:00
Lisa Cawley
9833f0f598
[OAS][DOCS] Add example for import saved objects API (#192291) 2024-09-09 12:17:31 -07:00
Luke Elmers
b6287708f6
Adds AGPL 3.0 license (#192025)
Updates files outside of x-pack to be triple-licensed under Elastic
License 2.0, AGPL 3.0, or SSPL 1.0.
2024-09-06 19:02:41 -06:00
Christiane (Tina) Heiligers
dd221a7be1
[Docs] Add details to SO APIs landing page (#191693)
Fix https://github.com/elastic/kibana/issues/191534
The deprecation warning in the Kibana Saved Objects API main page was
removed in https://github.com/elastic/kibana/pull/190654.

This PR adds a section about when the APIs will be removed and what to
use instead.

The PR also includes updates to other API main pages that mention the SO
APIs.

- [x]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials

VIew the [html
diff](https://kibana_bk_191693.docs-preview.app.elstc.co/diff) for these
changes:

![Short URLs API landing
page](https://github.com/user-attachments/assets/3716f33e-0d00-4ff7-b29d-7a5ba0a0f1f2)

![Data views API landing
page](https://github.com/user-attachments/assets/81c8a843-27ca-4510-a181-7ec9b20f86d6)

The updated OpenAPI document looks like this in a Bump.sh preview:


![image](https://github.com/user-attachments/assets/a8b58142-5082-4b75-8b3f-339b8a6b57e4)

---------

Co-authored-by: lcawl <lcawley@elastic.co>
2024-08-29 15:04:00 -05:00
elastic-renovate-prod[bot]
68a924411b
Update dependency @elastic/elasticsearch to ^8.15.0 (main) (#190378)
Co-authored-by: elastic-renovate-prod[bot] <174716857+elastic-renovate-prod[bot]@users.noreply.github.com>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Alejandro Fernández Haro <alejandro.haro@elastic.co>
Co-authored-by: Walter Rafelsberger <walter.rafelsberger@elastic.co>
2024-08-23 12:48:10 -05:00
Larry Gregory
74d88580a5
Migrate codebase to use Object.hasOwn instead of Object.hasOwnProperty (#186829)
## Summary

This PR has breadth, but not depth. This adds 3 new `eslint` rules. The
first two protect against the use of code generated from strings (`eval`
and friends), which will not work client-side due to our CSP, and is not
something we wish to support server-side. The last rule aims to prevent
a subtle class of bugs, and to defend against a subset of prototype
pollution exploits:

- `no-new-func` to be compliant with our CSP, and to prevent code
execution from strings server-side:
https://eslint.org/docs/latest/rules/no-new-func
- `no-implied-eval` to be compliant with our CSP, and to prevent code
execution from strings server-side:
https://eslint.org/docs/latest/rules/no-implied-eval. Note that this
function implies that it prevents no-new-func, but I don't see [test
cases](https://github.com/eslint/eslint/blob/main/tests/lib/rules/no-implied-eval.js)
covering this behavior, so I think we should play it safe and enable
both rules.
- `no-prototype-builtins` to prevent accessing shadowed properties:
https://eslint.org/docs/latest/rules/no-prototype-builtins


In order to be compliant with `no-prototype-builtins`, I've migrated all
usages and variants of `Object.hasOwnProperty` to use the newer
[`Object.hasOwn`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn).
2024-08-13 10:30:19 -05:00
Gerard Soldevila
d9c1f9702b
[Usage Counters] Enhancements to the APIs (#187665)
## Summary

Part of https://github.com/elastic/kibana/issues/186530
Follow-up of https://github.com/elastic/kibana/pull/187064 

The goal of this PR is to provide the necessary means to allow
implementing the [Counting
views](https://docs.google.com/document/d/1W77qoweixcjrq0sEKh_LjIk3j33Xyy9umod9mG9BlOM/edit)
part of the _Dashboards++_ initiative.
We do this by extending the capabilities of the _usage counters_ APIs:
* We support custom retention periods. Currently data is only kept in SO
indices for 5 days. Having 90 days worth of counting was required for
Dashboards++.
* We expose a Search API that will allow retrieving persisted counters.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-08-05 09:33:27 -05:00
Lisa Cawley
e4a0658225
[OAS][DOCS] Deprecate saved object APIs (#189223) 2024-07-30 21:38:04 -05:00
Alejandro Fernández Haro
11b750b10a
Minimize shared-common everywhere (#188606)
## Summary


![8xfggo](https://github.com/user-attachments/assets/f3d9312f-2ad3-4fa2-9daf-01e2b1ad6cac)

At the moment, our package generator creates all packages with the type
`shared-common`. This means that we cannot enforce boundaries between
server-side-only code and the browser, and vice-versa.

- [x] I started fixing `packages/core/*`
- [x] It took me to fixing `src/core/` type to be identified by the
`plugin` pattern (`public` and `server` directories) vs. a package
(either common, or single-scoped)
- [x] Unsurprisingly, this extended to packages importing core packages
hitting the boundaries eslint rules. And other packages importing the
latter.
- [x] Also a bunch of `common` logic that shouldn't be so _common_ 🙃 

### 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)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-29 12:47:46 -06:00
Nick Partridge
49a985625b
Upgrade prettier dependencies (#188032)
## Summary

- Upgrade `prettier` to `v2.8.x`.
- Upgrade related decencies.
- Adds `prettier` group to renovate config.
- Fixes bootstrapping type error.

## Main Changes

### Add parentheses for `TypeofTypeAnnotation` to improve readability

[link](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#add-parentheses-for-typeoftypeannotation-to-improve-readability-14458-by-fisker)

```ts
// Input
type A = (typeof node.children)[];

// Prettier 2.8.4
type A = typeof node.children[];

// Prettier 2.8.5
type A = (typeof node.children)[];
```

### Add parentheses to head of `ExpressionStatement` instead of the
whole statement


[link](https://github.com/prettier/prettier/blob/main/CHANGELOG.md#add-parentheses-to-head-of-expressionstatement-instead-of-the-whole-statement-14077-by-fisker)

```ts
// Input
({}).toString.call(foo) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo);

// Prettier 2.8.1
({}.toString.call(foo) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo));

// Prettier 2.8.2
({}).toString.call(foo.forEach) === "[object Array]"
  ? foo.forEach(iterateArray)
  : iterateObject(foo);
```

## Details

This started because I noticed we were on `typescript@^5` but still on
an old prettier that complained about use of new TS features such as
[`satisfies`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-9.html#the-satisfies-operator).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-24 17:29:05 +01:00
Pierre Gayvallet
10edbf1054
Enforce correct shape for SO attributes and id during create operations (#187876)
## Summary

Fix https://github.com/elastic/kibana/issues/123575
Fix https://github.com/elastic/kibana/issues/105039

This PR does two things:
- adapt SO ID validation to block empty strings (`""`), we we were
already doing with `undefined`
- add validation of the `attributes` to reject primitives and
`undefined` (only accept objects)
2024-07-12 01:10:48 +10:00
Lisa Cawley
dddcf2ef43
[HTTP/OAS] Add tags and summaries for saved object APIs (#184184)
Co-authored-by: Jean-Louis Leysens <jloleysens@gmail.com>
2024-07-08 09:54:52 -04:00
Gerard Soldevila
e524fb6324
Relocate usage-counters to dedicated index and split server Vs ui (#187064)
## Summary

Part of https://github.com/elastic/kibana/issues/186530.

This PR sets the basis for allowing namespaced usage counters.
It relocates `usage-counters` SO type from `.kibana` to a dedicated
`.kibana_usage_counters`.

Furthermore, the original SO type is removed, and replaced by 2 separate
types:
* `server-counters`
* `ui-counters`

Note that these 2 steps are necessary if we want to leverage
`namespaces` property of the saved objects.
We can't currently update the `namespaceType: 'agnostic'` without
causing a migration.
Thus, these two types will be defined as `namespaceType: single`.

Up until now, UI counters were stored under a special `domainId:
uiCounter`.
This forced a workaround that consisted in storing `appName:eventName`
in the `counterName` property of the SO.
Having a dedicated SO type for them allows to store `appName` as
`domainId`, avoiding the need for a
[workaround](https://github.com/elastic/kibana/blob/main/src/plugins/usage_collection/common/ui_counters.ts).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-07-05 21:18:36 +10:00
Pierre Gayvallet
1dee2872f3
Bump @elastic/elasticsearch to 8.14.0 (reloaded) (#186848)
## Summary

Reopening https://github.com/elastic/kibana/pull/186326 with my account,
non-internal PRs are just terrible to work with

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
Co-authored-by: Aleh Zasypkin <aleh.zasypkin@elastic.co>
2024-06-26 08:29:15 -07:00
Gerard Soldevila
37426f0bde
Check compatible cluster.routing.allocation.enable only on reindex migrations (#186090)
## Summary

Addresses https://github.com/elastic/kibana/issues/177831.

The PR introduces specific steps to check that
`cluster.routing.allocation.enable` has a suitable value for _reindex
migrations_.
Up until now, this check was done systematically after the `INIT` step.

Now, a couple new dedicated steps have been introduced, which allow
verifying this setting on _reindex migrations_ only (highlighted in
orange):


![image](07c7f0b4-fa11-4925-908a-3cb222685796)
2024-06-20 09:19:18 +02:00
Gerard Soldevila
dbdc797781
Prevent write blocking target index during reindex migration (#185939)
## Summary

Addresses https://github.com/elastic/kibana/issues/185918

The idea is to simply check whether the index that a migrator is trying
to `write_block` (aka the source of the reindex operation) matches the
target index name. In this case:
* We assume that other migrators are half way through, ahead of us.
* We abort operation and trust other instances' migrators to finish the
job.
* Subsequent restart, when migration has finished, should basically be a
no-op.
2024-06-19 10:15:05 +02:00
Lisa Cawley
88621152e0
[OAS] Refresh saved objects API document (#186134) 2024-06-13 10:11:59 -07:00
Jean-Louis Leysens
dc78221e2a
[HTTP/OAS] Make SO CRUD and resolve APIs internal on serverless (#184408) 2024-06-11 17:40:03 +02:00
Pierre Gayvallet
374282ded0
SOR: re-enable ES client retry mechanism (#184761)
## Summary

We recently "discovered" that ES calls performed from the SOR were not
having the default retry mechanism used by the ES client.

This is caused by the way we construct the ES client wrapper used for
the SOR, that forces the `maxRetries` option to `0`


8911bfabb0/packages/core/saved-objects/core-saved-objects-api-server-internal/src/lib/repository_es_client.ts (L38-L40)

I initially tried to fully get rid of `retryCallCluster` in
https://github.com/elastic/kibana/pull/184658, as we assumed that
re-enabling the retry mechanism would be sufficient, but this was
causing flakiness in test suites (uncaught rejections in plugins not
properly stopping after ES and Kibana are shut down, with
`NoLivingConnectionsError` errors...)

So instead, I just re-enabled the ES client native mechanism by removing
the `maxRetries` override.
2024-06-05 10:34:20 +02:00
Anton Dosov
88757a30a6
Add updated_by to saved objects (#182687)
## Summary

close https://github.com/elastic/kibana-team/issues/899

- Adds `updated_by` to saved object, similar to recently added
`created_by` https://github.com/elastic/kibana/pull/179344
- Fixes `created_by` / `created_at` should be set during upsert
- Improves functional tests coverage
2024-05-29 08:03:11 -07:00
Julia Bardi
ad03dfb1f5
[Fleet] Add warning if need root integrations trying to be used with unprivileged agents (#183283)
## Summary

Closes https://github.com/elastic/ingest-dev/issues/3252

## Add integration
Added warning to Add integration when the integration requires root
privilege and the selected existing agent policy has unprivileged agents
enrolled.

To verify:
- enroll an agent with docker (it has unprivileged: true)
- try to add an integration that requires root e.g. auditd_manager
- verify that when trying to save the integration, the warning callout
is part of the confirm deploy modal

<img width="807" alt="image"
src="420da729-a4f4-4861-9767-001699629397">

## Add agent flyout
Added warning to Add agent flyout when an unprivileged agent is detected
in combination with an agent policy that has integrations requiring root

To verify:
- add an integration to an agent policy that requires root e.g.
auditd_manager
- open Add agent flyout, verify that the warning callout is visible

<img width="1273" alt="image"
src="e4ae1d73-358b-4d3c-9ca0-27e88bc734a6">

### Open question:
- Do we want to show the warning on `Add agent flyout` only for newly
enrolled agents (in the last 10 mins like we query enrolled agents), or
any unprivileged agents that are enrolled to this policy?
- Decision: No longer applicable as we decided to not show a count here

### 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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-05-21 03:45:00 -07:00
Konrad Szwarc
3d1d2a5d43
[EDR Workflows] Unified Manifest - Manifest Manager (#179698)
This pull request introduces a new SO used for keeping relations between
artifactId and policyId. It addresses an issue where some users found
the single SO structure containing too many nested entries. Originally,
we planned to rewrite the existing Manifest Manager. However, during the
POC implementation, it became clear that the effort required to refactor
and retest the existing solution would be substantial. Therefore, this
pull request can be considered as the first step in transitioning our
approach from one SO to this new, distributed one.

The main idea behind these changes is to modify the structure of the SO,
rather than the logic of the Manifest Manager. To accomplish this, we
need to retrieve the SO from the new source, translate it into the
existing SO format (many SOs to one), execute the unchanged operations
of the Manifest Manager on artifacts, translate the resulting SO into
multiple SOs, and save them.

This change is expected to be deployed with a Feature Flag, and we need
to ensure that everything continues to function correctly in both cases.
Therefore, I've introduced a new FTR suite with the Feature Flag
enabled, which should be run alongside tests with the Feature Flag
disabled. This suite contains duplicated test files that depend on SO
logic. When we activate the Feature Flag, these tests should replace the
existing ones, as the Unified Manifest SO will become the default
approach.

It appears that there is no need to introduce any kind of migrations, as
the Manifest Manager is capable of recreating missing SOs (which has
been tested).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-05-17 16:57:12 +02:00
Gerard Soldevila
ed2e59fea9
Kbn 176803 cleanup 8.14 md5 check (#183416)
## Summary

Follow-up of #176803

Now that `8.14` has been branched and it is about to be released, we can
remove the test that ensures the `HASH_TO_VERSION_MAP` is aligned.

This PR also rolls back a few changes on the map that shouldn't have
been performed, as they belong to `8.15.0`.
2024-05-15 11:37:42 +02:00
Pierre Gayvallet
61e408c963
SOR: Add attr override option for update and bulkUpdate (#183267)
## Summary

Fix https://github.com/elastic/kibana/issues/183112

Add a new `mergeAttributes` option for both `update` and `bulkUpdate`,
which, when set to `false`, allows to perform a "full" update (fully
replacing the current attributes of the document) instead of a "partial"
one (merging the attributes).

Technically, ES doesn't really support it, so it was only made possible
due to the "client-side" update we implemented for ZDT / SO version BWC.
2024-05-15 11:02:32 +02:00
Cristina Amico
eb5e329382
[Fleet] Add support_agentless property in agent policy schema and preconfiguration (#182709)
Closes https://github.com/elastic/kibana/issues/180377

## Summary
Add a new `support_agentless` property in agent policy and in
preconfiguration; this property is only allowed when the environment has
both `isServerless` set to `true` and `agentless` feature flag enabled,
otherwise policy creation/update will throw error `supports_agentless is
only allowed in serverless environments that support agentless feature`.

No UI change is required for now as this property will be needed as part
of a wider support to agentless policies.

## Testing

### Serverless
- Run serverless env configured for agentless following [this
guide](https://docs.elastic.dev/security-solution/cloud-security/serverless/develop-for-kibana#agentless-local-set-up)
- Make sure to have `agentless` feature flag enabled
- Create an agent policy with `support_agentless`  property:
```
POST kbn:/api/fleet/agent_policies
{
  "name": "New agent policy",
  "namespace": "default",
  "supports_agentless": true
}
```
- Update an existing agent policy with the new property:
```
PUT kbn:/api/fleet/agent_policies/<opolicy_id>
{
  "name": "New agent policy",
  "supports_agentless": true
}
```

- Create a preconfigured agent policy in kibana.dev.yml, and verify it
that it's correct via `GET kbn:/api/fleet/agent_policies`:

```
xpack.fleet.agentPolicies: [
  {
    "name": "Agentless Policy",
    "id": "agentless",
    "is_managed": true,
    "namespace": "default",
    "supports_agentless": true,
  },
]
```

- Note that if `agentless` feature flag is disabled, any of the above
will throw an error.

### Stateful
Spin up a stateful env and verify that all of the previous commands fail
with `400` and above error message.

### Checklist
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-05-08 10:58:24 +02:00
Cristina Amico
2ecda69e64
[Fleet] Add overrides to package policies update endpoint (#181453)
Closes https://github.com/elastic/kibana/issues/177323

## Summary
Allow to override `inputs` in `PUT package_policies/:id` endpoint. This
functionality will be useful for support and troubleshooting purposes,
but it shouldn't be used in place of normal updates to the policies.

- `inputs` parameters are saved in package policy SO `overrides` field
and then
[merged](https://github.com/elastic/kibana/pull/181453/files#diff-ee6c1fe752205768ab54e6107a869041bcbb6130a0c982fa169bf5aba570a30eR84)
to the full agent policy
- `compiled_streams` and `compiled_inputs` are not allowed


Example with an Nginx policy:
```
PUT kbn:/api/fleet/package_policies/d4fd9578-534f-4e1a-bc75-dfbd4ff0aa14
{
  "overrides": {
    "inputs": {
        "logfile-system-d4fd9578-534f-4e1a-bc75-dfbd4ff0aa14": {
           "log_level": "debug"
        }
      }
  }
}
```
Result in full agent policy:

![Screenshot 2024-05-02 at 10 24
08](3772460b-de29-4679-90e6-d9fdb0d6d67d)


### Checklist

- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-05-02 13:14:47 +02:00
Gerard Soldevila
9d01ab1ee8
Add per SO type telemetry to core usage counters (#181063)
## Summary

Tackles https://github.com/elastic/kibana/issues/180366

Leverages existing `'core'` _Usage Counters_ to add per SO type
telemetry for the HTTP SO API calls.
2024-04-26 13:14:38 +02:00
Ying Mao
ee1552f10d
[Response Ops][Alerting] Backfill Rule Runs (#177622)
This is the feature branch that contains the following commits. Each
individual PR contains a summary and verification instructions.

- [Schedule backfill API](https://github.com/elastic/kibana/pull/176185)
- [Backfill task runner](https://github.com/elastic/kibana/pull/177640)
- [Get/Find/Delete backfill
API](https://github.com/elastic/kibana/pull/179975)
- [API key invalidation
update](https://github.com/elastic/kibana/pull/180749)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-04-25 15:36:01 -04:00
Kevin Delemme
721d354a13
[SLO] Implement federated views (#178050) 2024-04-16 09:15:51 -04:00
Pierre Gayvallet
65b1d9489a
Add log entry and telemetry info about time Kibana waits for ES during startup (#180765)
## Summary

This PR attempts to make it easier to quantity the time we're spending
waiting on ES during Kibana startup.

- Add a log entry once successfully connected to ES, surfacing the info
of how much time we waited.
- Add two new metric to our `kibana_started` event:
  - the time we spent waiting for ES
  - the time it took to perform the SO migration
 
Note that for "BWC" reasons (primarily - and simplicity's sake too)
we've not subtracting the time we spent from the `start` lifecycle
timing we already had.
2024-04-16 00:46:06 -07:00
Shahzad
29e8394c3d
[Synthetics] Monitor CRUD's public api's (#169928)
## Summary

Part of https://github.com/elastic/kibana/issues/169547

View docs at [Changed
pages](https://kibana_169928.docs-preview.app.elstc.co/diff)

Add monitor api public api 

### Testing

Make sure you have some monitors populated before testing this PR and
before switching to the branch

- [ ] Try editing already added monitors via API
- [ ] Test adding monitors via API, and then edit those via and
subsqeuently try editing via API the same monitor
- [ ] Test editing monitors via API
- [ ] Test deleting monitors via API
- [ ] Test getting monitors via API
- [ ] Testing private as well public locations

Basic workflow that i am interesting in testing is to make sure, you can
add/edit via both API and UI without any issues


Test each of HTTP/TCP/ICMP browser examples

<img width="1728" alt="image"
src="3575d93a-5f04-4c80-ac62-038643f466f8">

---------

Co-authored-by: Justin Kambic <jk@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Dominique Clarke <dominique.clarke@elastic.co>
2024-04-12 15:10:11 -04:00
Christos Nasikas
b735d8c569
[Cases] Case action (#168369)
## Summary

Depends on: https://github.com/elastic/kibana/pull/166267,
https://github.com/elastic/kibana/pull/170326,
https://github.com/elastic/kibana/pull/169484,
https://github.com/elastic/kibana/pull/173740,
https://github.com/elastic/kibana/pull/173763,
https://github.com/elastic/kibana/pull/178068,
https://github.com/elastic/kibana/pull/178307,
https://github.com/elastic/kibana/pull/178600,
https://github.com/elastic/kibana/pull/180437

PRs:
- https://github.com/elastic/kibana/pull/168370
- https://github.com/elastic/kibana/pull/169229
- https://github.com/elastic/kibana/pull/171754
- https://github.com/elastic/kibana/pull/172709
- https://github.com/elastic/kibana/pull/173012
- https://github.com/elastic/kibana/pull/175107
- https://github.com/elastic/kibana/pull/175452
- https://github.com/elastic/kibana/pull/175505
- https://github.com/elastic/kibana/pull/177033
- https://github.com/elastic/kibana/pull/178277
- https://github.com/elastic/kibana/pull/177139
- https://github.com/elastic/kibana/pull/179796

Fixes: https://github.com/elastic/kibana/issues/153837

## Testing

Run Kibana with `--run-examples` if you want to use the "Always firing"
rule.

Create a rule with a case action in observability and the stack. The
security solution is not supported. You should not be able to assign a
case action in a security solution rule.

1. Test the "Reopen closed cases" configuration.
2. Test the "Grouping by" configuration. Only one field is allowed. Not
all fields are persisted in alerts. If you select a field not part of
the alert the case action will create a case where the grouping value is
set to `unknow`.
3. Test the "Time window" feature. You can comment out the validation to
test for shorter times.
4. Verify that the case action is experimental.
5. Verify that based on the rule type the case is created in the correct
solution.
6. Verify that you cannot create a rule with the case action on the
basic license.
7. Verify that the execution of the case action fails if you do not have
permission for cases. Pending work on the system actions framework level
to not allow users to create rules with system actions where they do not
have permission.
8. Stress test the case action by creating multiple rules.

### Checklist

Delete any items that are not applicable to this PR.

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

### 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 notes

Automatically create cases when an alert is triggered.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: adcoelho <antonio.coelho@elastic.co>
Co-authored-by: Janki Salvi <117571355+js-jankisalvi@users.noreply.github.com>
2024-04-12 12:01:17 +03:00
Nicolas Chaulet
c88b3bdc95
[Fleet] Settings Framework API and UI (#179795)
## Summary

Follow up on https://github.com/elastic/kibana/pull/170539
Related to https://github.com/elastic/ingest-dev/issues/2471 (Phase 1)

Dynamically creating settings fields from configuration.
These settings are saved in the agent policy SO's `advanced_settings`
field.
In the current pr the agent policy read/create/update works including
the UI.
It still has to be extended to support a few more type of settings: e.g.
dropdown values, settings consisting of multiple fields.

<img width="2212" alt="image"
src="c2ee7187-41bf-42a4-8a22-f43ea8ccfb8c">

These settings are added to the full agent policy agents section:
<img width="687" alt="image"
src="05e244f3-148c-4c88-9b9c-fd665fd0154c">


## Old description:

Add support for saved object mapping and api field name,

## Example API calls and full policy generation

<img width="600" alt="Screenshot 2024-04-02 at 3 54 35 PM"
src="ee2ea087-3e02-4351-9138-c56ace1d5b34">
<img width="500" alt="Screenshot 2024-04-02 at 4 13 42 PM"
src="97514b2e-ef39-475e-8a88-1204ce2c0cda">
<img width="600" alt="Screenshot 2024-04-02 at 4 13 54 PM"
src="6553e133-ea07-48b5-b0ec-c45861b9b246">
<img width="600" alt="Screenshot 2024-04-02 at 5 42 27 PM"
src="faa560fd-7303-46f5-ae2e-034fc10dddfd">


## Open questions/Issues

### Saved objects

*I think we will still have to do some work to add a new model version
when adding a new saved object field, I do not see an easy way to
programatically generate that. In a first time it probably could be a
manual action to add those migration

### API

Open api generation, I think as a first iteration it could be a manual
operation to update openAPI spec, but we should be able to
programatically generate that with a script in the future

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Julia Bardi <90178898+juliaElastic@users.noreply.github.com>
Co-authored-by: Julia Bardi <julia.bardi@elastic.co>
2024-04-09 15:18:40 +02:00
Gerard Soldevila
9046abbe9a
Do not update+pickup docs if SO types mappings have not changed (#179937)
## Summary

Align V2 behavior with ZDT after
https://github.com/elastic/kibana/pull/179595

Under the assumption that whenever we want to add new root fields (e.g.
[created_by](https://github.com/elastic/kibana/pull/179344/)), we will
systematically add mappings for them, we can skip the
`updateAndPickupMappings` operation iif ONLY root fields' mappings have
changed during an upgrade (aka if none of the SO types have updated
their mappings).

Up until now, the logic was updating ALL SO types whenever a `root`
field was added / updated.
This is expensive and unnecessary, and can cause a noticeable impact to
large customers during migrations.
2024-04-09 11:29:31 +02:00
Cristina Amico
3a31ee0872
[Fleet] Implement state machine behavior for package install (#178657)
Closes https://github.com/elastic/kibana/issues/175592

## Summary
Implement state machine behavior for package install. It keeps track of
the current step and save it in the SO , then exposes it in
the`installationInfo` property.

- Implemented a generic state machine function that can automatically
handle state transitions based on a simple data structure:
https://github.com/elastic/kibana/pull/178657/files#diff-f350d9630cd1f22cd1b3e70c9e95388d72dc877190bbeb33c739cb0433949e95R1-R88.
In theory, this state machine could be reused for something else, since
is generic enough and it's decoupled from the transition functions that
we pass to it.
- The state transitions passed to the state machine are defined in
[services/epm/packages/install_steps.ts](5f09e58ae7/x-pack/plugins/fleet/server/services/epm/packages/install_steps.ts)
and are based off the existing steps in
10d5167fa7/x-pack/plugins/fleet/server/services/epm/packages/_install_package.ts (L61)
I simply divided that long function in smaller steps and wrapped them to
accept a common parameter, based off
[InstallContext](https://github.com/elastic/kibana/pull/178657/files#diff-39d1f59e77a329eb06241c220156e5cf2d350649bb548707b0b0f54365ea91bfR49-R72)
- Defined a **feature flag** `enablePackagesStateMachine` and called the
new
[installPackageWitStateMachine](https://github.com/elastic/kibana/pull/178657/files#diff-cf9cec44de2ad0a6a3b74cca05e5308231d57d5c3e180ae4bc5114c2bf9af4ebR466-R483)
only when it's enabled.
- For now this new function is only applied to
`InstallPackageFromRegistry`, so `upload` and `bundled` case don't use
it yet.

### Testing
- Enable `enablePackagesStateMachine` in kibana.dev.yml
- Try to install an integration from registry, either from API or UI.
For instance

```
POST kbn:api/fleet/epm/packages/nginx/1.20.0
```
The installation process should succeed and the installationInfo
property will expose the `latest_executed_state` along with the error.

<details>
  <summary>Screenshots</summary>

### Logging
With `logger.debug` enabled:
![Screenshot 2024-03-27 at 16 12
33](75fb4af8-675e-483e-a51f-eb4adbf9d2aa)

![Screenshot 2024-03-27 at 16 12
48](74092f6d-528c-4e8f-85ee-85e2852487b8)

### InstallationInfo object
Content of `installationInfo` property when install process was
successful:
![Screenshot 2024-03-27 at 16 13
54](c2535c8f-24f7-4b6c-8f58-dadf4c9b4b28)

### Errors during install process

I manually triggered an error inside `stepInstallIndexTemplatePipelines`
and it's reported in the `installationInfo` property along with the
latest executed step (latest successful state) and error message:

![Screenshot 2024-03-27 at 17 26
29](47d77330-bcbb-4608-9e42-c9f46e8831a1)


</details>



### Checklist
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [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
- [ ] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2024-04-08 14:31:00 +02:00
jennypavlova
c9846714f1
[Infra] Custom dashboards api and saved object redesign (#179576)
Closes #179356

## Summary

This PR changes the custom dashboards' saved object and API from having
one saved object per asset type to having one saved object per
dashboard.
| Before | After | 
|--------|------|
| ``` { dashboardIdList: string[]; assetType: string } ``` | ``` {
dashboardId: string; dashboardFilterAssetIdEnabled: boolean; assetType:
string; }```|

The API endpoints are changed as well to
`api/infra/{assetType}/custom-dashboards`:

 - GET  api/infra/host/custom-dashboards

 - POST api/infra/host/custom-dashboards
{ 
  "dashboardSavedObjectId": string,
  "dashboardFilterAssetIdEnabled": boolean
}

The new endpoints are using
`api/infra/{assetType}/custom-dashboards/{id}` where `id` is the id of
the saved object
- **new** PUT api/infra/host/custom-dashboards/123
- **new** DELETE api/infra/host/custom-dashboards/123

After adding the separate PUT endpoint I added a validation to prevent
posting the same dashboard object (payload with the same asset type and
dashboard id) twice. So if the POST endpoint is called twice with the
same params/payload it will return 400 and a message that the dashboard
already exists: "Dashboard with id {id} has already been linked to
{asset type}"


![image](0729a9b1-f8e9-40d9-8be1-f27bfa2b1e22)
 

Testing: 
1. Unit tests
 - Run in this order in separate terminal tabs/windows
- `node scripts/functional_tests_server --config
x-pack/test/api_integration/config`
- `node scripts/functional_test_runner --config
x-pack/test/api_integration/apis/metrics_ui/config.ts --grep 'Infra
Custom Dashboards API'`
2. Dev tools
 - First go to Stack Management > Advanced Settings
- Search for "infra" and enable `Custom dashboards for asset details in
Infrastructure`:
<img width="1704" alt="image"
src="614258c8-ee36-4466-b16c-d48f58c3f5dc">
 - Go to Dev Tools and run

   - POST:
 
 ```
  POST kbn:/api/infra/host/custom-dashboards
  { 
    "dashboardSavedObjectId": "123",
    "dashboardFilterAssetIdEnabled": true
  }
  ```
if the same payload is posted 2 times the **second** time the response
will be 400 because the dashboard for the current asset already exists:

   - GET: `GET  kbn:/api/infra/host/custom-dashboards` 
   Example Response: 
   ```
  [
    {
      "id": "a21acbc4-8102-4b09-8bd1-1a9aa4c36f10",
      "assetType": "host",
      "dashboardSavedObjectId": "123",
      "dashboardFilterAssetIdEnabled": true
    }
  ]
   ```
   - PUT (update the returned dashboard):
 
 ```
PUT
kbn:/api/infra/host/custom-dashboards/a21acbc4-8102-4b09-8bd1-1a9aa4c36f10
  { 
    "dashboardSavedObjectId": "123",
    "dashboardFilterAssetIdEnabled": false
  }
  ```
- DELETE (delete the returned dashboard): `DELETE
kbn:/api/infra/host/custom-dashboards/a21acbc4-8102-4b09-8bd1-1a9aa4c36f10`

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-04-04 10:26:52 -07:00
Anton Dosov
7d80e4f689
Add created_by to saved objects (#179344)
## Summary

This PR adds an optional `created_by` field to root saved object fields.
We're doing for adding a filter by an
author to the
dashboard listing page (and then other listings)


### Implementation 

#### `created_by: {type: keyword}`

In this implementation, I added `created_by` as a simple keyword field
assuming we will store `profile_uid` only

```
created_by: {
  type: 'keyword',
},
```

The `profile_uid` is not always available, as azasypkin described
[here](https://github.com/elastic/kibana/issues/175431#issuecomment-1914577548)
It is not available for anonymous users, for users authenticated via
proxy, and, in some cases, for API users authenticated with API keys.
But this is the best way to globally identify users and longer term we
might get `profile_uid` for all the users



#### Accessing `getCurrentUser` from saved object repo 

After exploring different options and discussing with pgayvallet we
decided to provide `getCurrentUser` through existing security extensions
as it's a better isolation of concern, and we avoid leaking the request
down to the SOR.
2024-04-04 17:38:05 +02:00
Alejandro Fernández Haro
947dac2846
Upgrade elasticsearch-js to 8.13.0 (#179747) 2024-04-03 08:56:29 -07:00
Alejandro Fernández Haro
1c1e20afdb
Use rxjs instead of rxjs/operators (#179553) 2024-04-02 11:41:33 -07:00
Pierre Gayvallet
8b95195b68
[ZDT] add aliases when creating the index (#179792)
## Summary

Fix https://github.com/elastic/kibana/issues/179783

Create the aliases during initial index creation, instead of doing it in
a later stage. This avoids an additional roundtrip with ES during
project creation.

**Before:** 
```
INIT -> CREATE_TARGET_INDEX -> UPDATE_ALIASES -> INDEX_STATE_UPDATE_DONE -> DONE
```

**After:** 
```
INIT -> CREATE_TARGET_INDEX -> INDEX_STATE_UPDATE_DONE -> DONE
```
2024-04-02 08:19:13 -07:00
Pierre Gayvallet
f89c3e06cc
[ZDT migration] support root field addition (#179595)
## Summary

Fix https://github.com/elastic/kibana/issues/179258

Change the version compatibility and mapping generation
(`checkVersionCompatibility` and `generateAdditiveMappingDiff`) of the
ZDT migration algorithm to support the scenario were root fields are
added (adding new fields to our base mappings)
2024-04-02 05:13:51 -07:00
Alejandro Fernández Haro
73347f6cb2
[Part of #176153] Saved objects (#179752) 2024-04-02 10:57:51 +02:00