Skip to content

[Watcher] Fix watches table#218853

Merged
ElenaStoeva merged 10 commits intoelastic:mainfrom
ElenaStoeva:watcher/fix-fetched-watches
Apr 28, 2025
Merged

[Watcher] Fix watches table#218853
ElenaStoeva merged 10 commits intoelastic:mainfrom
ElenaStoeva:watcher/fix-fetched-watches

Conversation

@ElenaStoeva
Copy link
Contributor

@ElenaStoeva ElenaStoeva commented Apr 22, 2025

Fixes #218341

Summary

This PR fixes the watches table where only up to 10 watches were previously displayed because the Query Watch API returns maximum 10 watches by default. To fix this and to avoid performance issues for clusters with a large number of watches, we use pagination to only fetch the watches for the current page.

Limitations:

  • The Query Watch API only allows sorting by _id and metadata.* fields. However, we cannot allow sorting by ID in the table because this requires enabling the indices.id_field_data.enabled cluster setting, which is disabled by default in the cluster. We can only sort by Name because the name is part of the metadata property. Therefore, we need to remove sorting for all columns but the Name.
  • We cannot utilize the native behavior of the Search bar where the table would filter all items by itself, since in this case it would only filter the current page of watches. We need to pass the query to the Query Watches API. However, again only the _id and metadata.* fields can be searched. Additionally, for _id we cannot use a wildcard query so the user would need to input the whole id for the requested watch to be displayed. For name, we can use a wildcard query so searching by a substring of a name should work.

How to test:

  1. Create more than 10 watches through the UI or with a Console request:
PUT _watcher/watch/{id}
{
  "metadata": {
    "name": "test-watch-{id}",
    "xpack": {
      "type": "json"
    }
  },
  "trigger": {
    "schedule": {
      "interval": "30m"
    }
  }
}
  1. Verify that all watches can be viewed in the table and that they can be sorted by Name and search by Name or ID.
Screen.Recording.2025-04-24.at.16.09.29.mov
@ElenaStoeva ElenaStoeva changed the title [Console] Fix watches table Apr 23, 2025
@ElenaStoeva ElenaStoeva self-assigned this Apr 23, 2025
@ElenaStoeva ElenaStoeva added Feature:Watcher Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// backport:prev-minor release_note:skip Skip the PR/issue when compiling release notes labels Apr 23, 2025
@ElenaStoeva
Copy link
Contributor Author

/ci

@ElenaStoeva ElenaStoeva marked this pull request as ready for review April 24, 2025 13:12
@ElenaStoeva ElenaStoeva requested a review from a team as a code owner April 24, 2025 13:12
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-management (Team:Kibana Management)

@ElenaStoeva
Copy link
Contributor Author

/ci

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
watcher 156.6KB 156.8KB +248.0B

History

cc @ElenaStoeva

Copy link
Contributor

@mattkime mattkime left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes look good and work well!

@ElenaStoeva ElenaStoeva merged commit d9c4817 into elastic:main Apr 28, 2025
9 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.18, 8.19, 9.0

https://github.com/elastic/kibana/actions/runs/14708552572

kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Apr 28, 2025
Fixes elastic#218341

## Summary

This PR fixes the watches table where only up to 10 watches were
previously displayed because the Query Watch API returns maximum 10
watches by default. To fix this and to avoid performance issues for
clusters with a large number of watches, we use pagination to only fetch
the watches for the current page.

**Limitations:**
- The Query Watch API only allows sorting by `_id` and `metadata.*`
fields. However, we cannot allow sorting by ID in the table because this
requires enabling the `indices.id_field_data.enabled` cluster setting,
which is disabled by default in the cluster. We can only sort by Name
because the name is part of the `metadata` property. Therefore, we need
to remove sorting for all columns but the Name.
- We cannot utilize the native behavior of the Search bar where the
table would filter all items by itself, since in this case it would only
filter the current page of watches. We need to pass the query to the
Query Watches API. However, again only the `_id` and `metadata.*` fields
can be searched. Additionally, for `_id` we cannot use a wildcard query
so the user would need to input the whole id for the requested watch to
be displayed. For name, we can use a wildcard query so searching by a
substring of a name should work.

**How to test:**
1. Create more than 10 watches through the UI or with a Console request:

```
PUT _watcher/watch/{id}
{
  "metadata": {
    "name": "test-watch-{id}",
    "xpack": {
      "type": "json"
    }
  },
  "trigger": {
    "schedule": {
      "interval": "30m"
    }
  }
}
```
2. Verify that all watches can be viewed in the table and that they can
be sorted by Name and search by Name or ID.

https://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Matthew Kime <matt@mattki.me>
(cherry picked from commit d9c4817)
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Apr 28, 2025
Fixes elastic#218341

## Summary

This PR fixes the watches table where only up to 10 watches were
previously displayed because the Query Watch API returns maximum 10
watches by default. To fix this and to avoid performance issues for
clusters with a large number of watches, we use pagination to only fetch
the watches for the current page.

**Limitations:**
- The Query Watch API only allows sorting by `_id` and `metadata.*`
fields. However, we cannot allow sorting by ID in the table because this
requires enabling the `indices.id_field_data.enabled` cluster setting,
which is disabled by default in the cluster. We can only sort by Name
because the name is part of the `metadata` property. Therefore, we need
to remove sorting for all columns but the Name.
- We cannot utilize the native behavior of the Search bar where the
table would filter all items by itself, since in this case it would only
filter the current page of watches. We need to pass the query to the
Query Watches API. However, again only the `_id` and `metadata.*` fields
can be searched. Additionally, for `_id` we cannot use a wildcard query
so the user would need to input the whole id for the requested watch to
be displayed. For name, we can use a wildcard query so searching by a
substring of a name should work.

**How to test:**
1. Create more than 10 watches through the UI or with a Console request:

```
PUT _watcher/watch/{id}
{
  "metadata": {
    "name": "test-watch-{id}",
    "xpack": {
      "type": "json"
    }
  },
  "trigger": {
    "schedule": {
      "interval": "30m"
    }
  }
}
```
2. Verify that all watches can be viewed in the table and that they can
be sorted by Name and search by Name or ID.

https://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Matthew Kime <matt@mattki.me>
(cherry picked from commit d9c4817)
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Apr 28, 2025
Fixes elastic#218341

## Summary

This PR fixes the watches table where only up to 10 watches were
previously displayed because the Query Watch API returns maximum 10
watches by default. To fix this and to avoid performance issues for
clusters with a large number of watches, we use pagination to only fetch
the watches for the current page.

**Limitations:**
- The Query Watch API only allows sorting by `_id` and `metadata.*`
fields. However, we cannot allow sorting by ID in the table because this
requires enabling the `indices.id_field_data.enabled` cluster setting,
which is disabled by default in the cluster. We can only sort by Name
because the name is part of the `metadata` property. Therefore, we need
to remove sorting for all columns but the Name.
- We cannot utilize the native behavior of the Search bar where the
table would filter all items by itself, since in this case it would only
filter the current page of watches. We need to pass the query to the
Query Watches API. However, again only the `_id` and `metadata.*` fields
can be searched. Additionally, for `_id` we cannot use a wildcard query
so the user would need to input the whole id for the requested watch to
be displayed. For name, we can use a wildcard query so searching by a
substring of a name should work.

**How to test:**
1. Create more than 10 watches through the UI or with a Console request:

```
PUT _watcher/watch/{id}
{
  "metadata": {
    "name": "test-watch-{id}",
    "xpack": {
      "type": "json"
    }
  },
  "trigger": {
    "schedule": {
      "interval": "30m"
    }
  }
}
```
2. Verify that all watches can be viewed in the table and that they can
be sorted by Name and search by Name or ID.

https://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Matthew Kime <matt@mattki.me>
(cherry picked from commit d9c4817)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.18
8.19
9.0

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Apr 28, 2025
# Backport

This will backport the following commits from `main` to `9.0`:
- [[Watcher] Fix watches table
(#218853)](#218853)

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

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

<!--BACKPORT [{"author":{"name":"Elena
Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-28T13:07:42Z","message":"[Watcher]
Fix watches table (#218853)\n\nFixes
https://github.com/elastic/kibana/issues/218341\n\n## Summary\n\nThis PR
fixes the watches table where only up to 10 watches were\npreviously
displayed because the Query Watch API returns maximum 10\nwatches by
default. To fix this and to avoid performance issues for\nclusters with
a large number of watches, we use pagination to only fetch\nthe watches
for the current page.\n\n**Limitations:**\n- The Query Watch API only
allows sorting by `_id` and `metadata.*`\nfields. However, we cannot
allow sorting by ID in the table because this\nrequires enabling the
`indices.id_field_data.enabled` cluster setting,\nwhich is disabled by
default in the cluster. We can only sort by Name\nbecause the name is
part of the `metadata` property. Therefore, we need\nto remove sorting
for all columns but the Name.\n- We cannot utilize the native behavior
of the Search bar where the\ntable would filter all items by itself,
since in this case it would only\nfilter the current page of watches. We
need to pass the query to the\nQuery Watches API. However, again only
the `_id` and `metadata.*` fields\ncan be searched. Additionally, for
`_id` we cannot use a wildcard query\nso the user would need to input
the whole id for the requested watch to\nbe displayed. For name, we can
use a wildcard query so searching by a\nsubstring of a name should
work.\n\n**How to test:**\n1. Create more than 10 watches through the UI
or with a Console request:\n\n```\nPUT _watcher/watch/{id}\n{\n
\"metadata\": {\n \"name\": \"test-watch-{id}\",\n \"xpack\": {\n
\"type\": \"json\"\n }\n },\n \"trigger\": {\n \"schedule\": {\n
\"interval\": \"30m\"\n }\n }\n}\n```\n2. Verify that all watches can be
viewed in the table and that they can\nbe sorted by Name and search by
Name or
ID.\n\n\n\n\n\nhttps://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Matthew Kime
<matt@mattki.me>","sha":"d9c481799f0edb3088595d21e4d7615b1a4e12f6","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Watcher","Team:Kibana
Management","release_note:skip","backport:prev-minor","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[Watcher]
Fix watches
table","number":218853,"url":"https://github.com/elastic/kibana/pull/218853","mergeCommit":{"message":"[Watcher]
Fix watches table (#218853)\n\nFixes
https://github.com/elastic/kibana/issues/218341\n\n## Summary\n\nThis PR
fixes the watches table where only up to 10 watches were\npreviously
displayed because the Query Watch API returns maximum 10\nwatches by
default. To fix this and to avoid performance issues for\nclusters with
a large number of watches, we use pagination to only fetch\nthe watches
for the current page.\n\n**Limitations:**\n- The Query Watch API only
allows sorting by `_id` and `metadata.*`\nfields. However, we cannot
allow sorting by ID in the table because this\nrequires enabling the
`indices.id_field_data.enabled` cluster setting,\nwhich is disabled by
default in the cluster. We can only sort by Name\nbecause the name is
part of the `metadata` property. Therefore, we need\nto remove sorting
for all columns but the Name.\n- We cannot utilize the native behavior
of the Search bar where the\ntable would filter all items by itself,
since in this case it would only\nfilter the current page of watches. We
need to pass the query to the\nQuery Watches API. However, again only
the `_id` and `metadata.*` fields\ncan be searched. Additionally, for
`_id` we cannot use a wildcard query\nso the user would need to input
the whole id for the requested watch to\nbe displayed. For name, we can
use a wildcard query so searching by a\nsubstring of a name should
work.\n\n**How to test:**\n1. Create more than 10 watches through the UI
or with a Console request:\n\n```\nPUT _watcher/watch/{id}\n{\n
\"metadata\": {\n \"name\": \"test-watch-{id}\",\n \"xpack\": {\n
\"type\": \"json\"\n }\n },\n \"trigger\": {\n \"schedule\": {\n
\"interval\": \"30m\"\n }\n }\n}\n```\n2. Verify that all watches can be
viewed in the table and that they can\nbe sorted by Name and search by
Name or
ID.\n\n\n\n\n\nhttps://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Matthew Kime
<matt@mattki.me>","sha":"d9c481799f0edb3088595d21e4d7615b1a4e12f6"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218853","number":218853,"mergeCommit":{"message":"[Watcher]
Fix watches table (#218853)\n\nFixes
https://github.com/elastic/kibana/issues/218341\n\n## Summary\n\nThis PR
fixes the watches table where only up to 10 watches were\npreviously
displayed because the Query Watch API returns maximum 10\nwatches by
default. To fix this and to avoid performance issues for\nclusters with
a large number of watches, we use pagination to only fetch\nthe watches
for the current page.\n\n**Limitations:**\n- The Query Watch API only
allows sorting by `_id` and `metadata.*`\nfields. However, we cannot
allow sorting by ID in the table because this\nrequires enabling the
`indices.id_field_data.enabled` cluster setting,\nwhich is disabled by
default in the cluster. We can only sort by Name\nbecause the name is
part of the `metadata` property. Therefore, we need\nto remove sorting
for all columns but the Name.\n- We cannot utilize the native behavior
of the Search bar where the\ntable would filter all items by itself,
since in this case it would only\nfilter the current page of watches. We
need to pass the query to the\nQuery Watches API. However, again only
the `_id` and `metadata.*` fields\ncan be searched. Additionally, for
`_id` we cannot use a wildcard query\nso the user would need to input
the whole id for the requested watch to\nbe displayed. For name, we can
use a wildcard query so searching by a\nsubstring of a name should
work.\n\n**How to test:**\n1. Create more than 10 watches through the UI
or with a Console request:\n\n```\nPUT _watcher/watch/{id}\n{\n
\"metadata\": {\n \"name\": \"test-watch-{id}\",\n \"xpack\": {\n
\"type\": \"json\"\n }\n },\n \"trigger\": {\n \"schedule\": {\n
\"interval\": \"30m\"\n }\n }\n}\n```\n2. Verify that all watches can be
viewed in the table and that they can\nbe sorted by Name and search by
Name or
ID.\n\n\n\n\n\nhttps://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Matthew Kime
<matt@mattki.me>","sha":"d9c481799f0edb3088595d21e4d7615b1a4e12f6"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com>
Co-authored-by: Matthew Kime <matt@mattki.me>
kibanamachine added a commit that referenced this pull request Apr 28, 2025
# Backport

This will backport the following commits from `main` to `8.19`:
- [[Watcher] Fix watches table
(#218853)](#218853)

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

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

<!--BACKPORT [{"author":{"name":"Elena
Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-28T13:07:42Z","message":"[Watcher]
Fix watches table (#218853)\n\nFixes
https://github.com/elastic/kibana/issues/218341\n\n## Summary\n\nThis PR
fixes the watches table where only up to 10 watches were\npreviously
displayed because the Query Watch API returns maximum 10\nwatches by
default. To fix this and to avoid performance issues for\nclusters with
a large number of watches, we use pagination to only fetch\nthe watches
for the current page.\n\n**Limitations:**\n- The Query Watch API only
allows sorting by `_id` and `metadata.*`\nfields. However, we cannot
allow sorting by ID in the table because this\nrequires enabling the
`indices.id_field_data.enabled` cluster setting,\nwhich is disabled by
default in the cluster. We can only sort by Name\nbecause the name is
part of the `metadata` property. Therefore, we need\nto remove sorting
for all columns but the Name.\n- We cannot utilize the native behavior
of the Search bar where the\ntable would filter all items by itself,
since in this case it would only\nfilter the current page of watches. We
need to pass the query to the\nQuery Watches API. However, again only
the `_id` and `metadata.*` fields\ncan be searched. Additionally, for
`_id` we cannot use a wildcard query\nso the user would need to input
the whole id for the requested watch to\nbe displayed. For name, we can
use a wildcard query so searching by a\nsubstring of a name should
work.\n\n**How to test:**\n1. Create more than 10 watches through the UI
or with a Console request:\n\n```\nPUT _watcher/watch/{id}\n{\n
\"metadata\": {\n \"name\": \"test-watch-{id}\",\n \"xpack\": {\n
\"type\": \"json\"\n }\n },\n \"trigger\": {\n \"schedule\": {\n
\"interval\": \"30m\"\n }\n }\n}\n```\n2. Verify that all watches can be
viewed in the table and that they can\nbe sorted by Name and search by
Name or
ID.\n\n\n\n\n\nhttps://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Matthew Kime
<matt@mattki.me>","sha":"d9c481799f0edb3088595d21e4d7615b1a4e12f6","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Watcher","Team:Kibana
Management","release_note:skip","backport:prev-minor","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[Watcher]
Fix watches
table","number":218853,"url":"https://github.com/elastic/kibana/pull/218853","mergeCommit":{"message":"[Watcher]
Fix watches table (#218853)\n\nFixes
https://github.com/elastic/kibana/issues/218341\n\n## Summary\n\nThis PR
fixes the watches table where only up to 10 watches were\npreviously
displayed because the Query Watch API returns maximum 10\nwatches by
default. To fix this and to avoid performance issues for\nclusters with
a large number of watches, we use pagination to only fetch\nthe watches
for the current page.\n\n**Limitations:**\n- The Query Watch API only
allows sorting by `_id` and `metadata.*`\nfields. However, we cannot
allow sorting by ID in the table because this\nrequires enabling the
`indices.id_field_data.enabled` cluster setting,\nwhich is disabled by
default in the cluster. We can only sort by Name\nbecause the name is
part of the `metadata` property. Therefore, we need\nto remove sorting
for all columns but the Name.\n- We cannot utilize the native behavior
of the Search bar where the\ntable would filter all items by itself,
since in this case it would only\nfilter the current page of watches. We
need to pass the query to the\nQuery Watches API. However, again only
the `_id` and `metadata.*` fields\ncan be searched. Additionally, for
`_id` we cannot use a wildcard query\nso the user would need to input
the whole id for the requested watch to\nbe displayed. For name, we can
use a wildcard query so searching by a\nsubstring of a name should
work.\n\n**How to test:**\n1. Create more than 10 watches through the UI
or with a Console request:\n\n```\nPUT _watcher/watch/{id}\n{\n
\"metadata\": {\n \"name\": \"test-watch-{id}\",\n \"xpack\": {\n
\"type\": \"json\"\n }\n },\n \"trigger\": {\n \"schedule\": {\n
\"interval\": \"30m\"\n }\n }\n}\n```\n2. Verify that all watches can be
viewed in the table and that they can\nbe sorted by Name and search by
Name or
ID.\n\n\n\n\n\nhttps://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Matthew Kime
<matt@mattki.me>","sha":"d9c481799f0edb3088595d21e4d7615b1a4e12f6"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218853","number":218853,"mergeCommit":{"message":"[Watcher]
Fix watches table (#218853)\n\nFixes
https://github.com/elastic/kibana/issues/218341\n\n## Summary\n\nThis PR
fixes the watches table where only up to 10 watches were\npreviously
displayed because the Query Watch API returns maximum 10\nwatches by
default. To fix this and to avoid performance issues for\nclusters with
a large number of watches, we use pagination to only fetch\nthe watches
for the current page.\n\n**Limitations:**\n- The Query Watch API only
allows sorting by `_id` and `metadata.*`\nfields. However, we cannot
allow sorting by ID in the table because this\nrequires enabling the
`indices.id_field_data.enabled` cluster setting,\nwhich is disabled by
default in the cluster. We can only sort by Name\nbecause the name is
part of the `metadata` property. Therefore, we need\nto remove sorting
for all columns but the Name.\n- We cannot utilize the native behavior
of the Search bar where the\ntable would filter all items by itself,
since in this case it would only\nfilter the current page of watches. We
need to pass the query to the\nQuery Watches API. However, again only
the `_id` and `metadata.*` fields\ncan be searched. Additionally, for
`_id` we cannot use a wildcard query\nso the user would need to input
the whole id for the requested watch to\nbe displayed. For name, we can
use a wildcard query so searching by a\nsubstring of a name should
work.\n\n**How to test:**\n1. Create more than 10 watches through the UI
or with a Console request:\n\n```\nPUT _watcher/watch/{id}\n{\n
\"metadata\": {\n \"name\": \"test-watch-{id}\",\n \"xpack\": {\n
\"type\": \"json\"\n }\n },\n \"trigger\": {\n \"schedule\": {\n
\"interval\": \"30m\"\n }\n }\n}\n```\n2. Verify that all watches can be
viewed in the table and that they can\nbe sorted by Name and search by
Name or
ID.\n\n\n\n\n\nhttps://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Matthew Kime
<matt@mattki.me>","sha":"d9c481799f0edb3088595d21e4d7615b1a4e12f6"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com>
Co-authored-by: Matthew Kime <matt@mattki.me>
kibanamachine added a commit that referenced this pull request Apr 28, 2025
# Backport

This will backport the following commits from `main` to `8.18`:
- [[Watcher] Fix watches table
(#218853)](#218853)

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

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

<!--BACKPORT [{"author":{"name":"Elena
Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-04-28T13:07:42Z","message":"[Watcher]
Fix watches table (#218853)\n\nFixes
https://github.com/elastic/kibana/issues/218341\n\n## Summary\n\nThis PR
fixes the watches table where only up to 10 watches were\npreviously
displayed because the Query Watch API returns maximum 10\nwatches by
default. To fix this and to avoid performance issues for\nclusters with
a large number of watches, we use pagination to only fetch\nthe watches
for the current page.\n\n**Limitations:**\n- The Query Watch API only
allows sorting by `_id` and `metadata.*`\nfields. However, we cannot
allow sorting by ID in the table because this\nrequires enabling the
`indices.id_field_data.enabled` cluster setting,\nwhich is disabled by
default in the cluster. We can only sort by Name\nbecause the name is
part of the `metadata` property. Therefore, we need\nto remove sorting
for all columns but the Name.\n- We cannot utilize the native behavior
of the Search bar where the\ntable would filter all items by itself,
since in this case it would only\nfilter the current page of watches. We
need to pass the query to the\nQuery Watches API. However, again only
the `_id` and `metadata.*` fields\ncan be searched. Additionally, for
`_id` we cannot use a wildcard query\nso the user would need to input
the whole id for the requested watch to\nbe displayed. For name, we can
use a wildcard query so searching by a\nsubstring of a name should
work.\n\n**How to test:**\n1. Create more than 10 watches through the UI
or with a Console request:\n\n```\nPUT _watcher/watch/{id}\n{\n
\"metadata\": {\n \"name\": \"test-watch-{id}\",\n \"xpack\": {\n
\"type\": \"json\"\n }\n },\n \"trigger\": {\n \"schedule\": {\n
\"interval\": \"30m\"\n }\n }\n}\n```\n2. Verify that all watches can be
viewed in the table and that they can\nbe sorted by Name and search by
Name or
ID.\n\n\n\n\n\nhttps://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Matthew Kime
<matt@mattki.me>","sha":"d9c481799f0edb3088595d21e4d7615b1a4e12f6","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Watcher","Team:Kibana
Management","release_note:skip","backport:prev-minor","v9.1.0","v8.19.0","v8.18.1","v9.0.1"],"title":"[Watcher]
Fix watches
table","number":218853,"url":"https://github.com/elastic/kibana/pull/218853","mergeCommit":{"message":"[Watcher]
Fix watches table (#218853)\n\nFixes
https://github.com/elastic/kibana/issues/218341\n\n## Summary\n\nThis PR
fixes the watches table where only up to 10 watches were\npreviously
displayed because the Query Watch API returns maximum 10\nwatches by
default. To fix this and to avoid performance issues for\nclusters with
a large number of watches, we use pagination to only fetch\nthe watches
for the current page.\n\n**Limitations:**\n- The Query Watch API only
allows sorting by `_id` and `metadata.*`\nfields. However, we cannot
allow sorting by ID in the table because this\nrequires enabling the
`indices.id_field_data.enabled` cluster setting,\nwhich is disabled by
default in the cluster. We can only sort by Name\nbecause the name is
part of the `metadata` property. Therefore, we need\nto remove sorting
for all columns but the Name.\n- We cannot utilize the native behavior
of the Search bar where the\ntable would filter all items by itself,
since in this case it would only\nfilter the current page of watches. We
need to pass the query to the\nQuery Watches API. However, again only
the `_id` and `metadata.*` fields\ncan be searched. Additionally, for
`_id` we cannot use a wildcard query\nso the user would need to input
the whole id for the requested watch to\nbe displayed. For name, we can
use a wildcard query so searching by a\nsubstring of a name should
work.\n\n**How to test:**\n1. Create more than 10 watches through the UI
or with a Console request:\n\n```\nPUT _watcher/watch/{id}\n{\n
\"metadata\": {\n \"name\": \"test-watch-{id}\",\n \"xpack\": {\n
\"type\": \"json\"\n }\n },\n \"trigger\": {\n \"schedule\": {\n
\"interval\": \"30m\"\n }\n }\n}\n```\n2. Verify that all watches can be
viewed in the table and that they can\nbe sorted by Name and search by
Name or
ID.\n\n\n\n\n\nhttps://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Matthew Kime
<matt@mattki.me>","sha":"d9c481799f0edb3088595d21e4d7615b1a4e12f6"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","8.18","9.0"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/218853","number":218853,"mergeCommit":{"message":"[Watcher]
Fix watches table (#218853)\n\nFixes
https://github.com/elastic/kibana/issues/218341\n\n## Summary\n\nThis PR
fixes the watches table where only up to 10 watches were\npreviously
displayed because the Query Watch API returns maximum 10\nwatches by
default. To fix this and to avoid performance issues for\nclusters with
a large number of watches, we use pagination to only fetch\nthe watches
for the current page.\n\n**Limitations:**\n- The Query Watch API only
allows sorting by `_id` and `metadata.*`\nfields. However, we cannot
allow sorting by ID in the table because this\nrequires enabling the
`indices.id_field_data.enabled` cluster setting,\nwhich is disabled by
default in the cluster. We can only sort by Name\nbecause the name is
part of the `metadata` property. Therefore, we need\nto remove sorting
for all columns but the Name.\n- We cannot utilize the native behavior
of the Search bar where the\ntable would filter all items by itself,
since in this case it would only\nfilter the current page of watches. We
need to pass the query to the\nQuery Watches API. However, again only
the `_id` and `metadata.*` fields\ncan be searched. Additionally, for
`_id` we cannot use a wildcard query\nso the user would need to input
the whole id for the requested watch to\nbe displayed. For name, we can
use a wildcard query so searching by a\nsubstring of a name should
work.\n\n**How to test:**\n1. Create more than 10 watches through the UI
or with a Console request:\n\n```\nPUT _watcher/watch/{id}\n{\n
\"metadata\": {\n \"name\": \"test-watch-{id}\",\n \"xpack\": {\n
\"type\": \"json\"\n }\n },\n \"trigger\": {\n \"schedule\": {\n
\"interval\": \"30m\"\n }\n }\n}\n```\n2. Verify that all watches can be
viewed in the table and that they can\nbe sorted by Name and search by
Name or
ID.\n\n\n\n\n\nhttps://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb\n\n---------\n\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\nCo-authored-by:
Matthew Kime
<matt@mattki.me>","sha":"d9c481799f0edb3088595d21e4d7615b1a4e12f6"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com>
Co-authored-by: Matthew Kime <matt@mattki.me>
akowalska622 pushed a commit to akowalska622/kibana that referenced this pull request May 29, 2025
Fixes elastic#218341

## Summary

This PR fixes the watches table where only up to 10 watches were
previously displayed because the Query Watch API returns maximum 10
watches by default. To fix this and to avoid performance issues for
clusters with a large number of watches, we use pagination to only fetch
the watches for the current page.

**Limitations:**
- The Query Watch API only allows sorting by `_id` and `metadata.*`
fields. However, we cannot allow sorting by ID in the table because this
requires enabling the `indices.id_field_data.enabled` cluster setting,
which is disabled by default in the cluster. We can only sort by Name
because the name is part of the `metadata` property. Therefore, we need
to remove sorting for all columns but the Name.
- We cannot utilize the native behavior of the Search bar where the
table would filter all items by itself, since in this case it would only
filter the current page of watches. We need to pass the query to the
Query Watches API. However, again only the `_id` and `metadata.*` fields
can be searched. Additionally, for `_id` we cannot use a wildcard query
so the user would need to input the whole id for the requested watch to
be displayed. For name, we can use a wildcard query so searching by a
substring of a name should work.

**How to test:**
1. Create more than 10 watches through the UI or with a Console request:

```
PUT _watcher/watch/{id}
{
  "metadata": {
    "name": "test-watch-{id}",
    "xpack": {
      "type": "json"
    }
  },
  "trigger": {
    "schedule": {
      "interval": "30m"
    }
  }
}
```
2. Verify that all watches can be viewed in the table and that they can
be sorted by Name and search by Name or ID.





https://github.com/user-attachments/assets/6c812c5d-51e9-472c-a4d9-b1035843b9bb

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Matthew Kime <matt@mattki.me>
ElenaStoeva added a commit to ElenaStoeva/kibana that referenced this pull request Jun 13, 2025
ElenaStoeva added a commit that referenced this pull request Jun 16, 2025
Fixes #221820
Fixes #220879

## Summary

This PR reverts #204296 and
#218853 as these PRs caused issues
in the UI due to limitations in the Query Watches API. Therefore, we are
temporarily reverting back to fetching watches through the `.watches`
system index until we have better support from the Query Watches API.

**How to test:**
1. Start Es with `yarn es snapshot --license=trial` and Kibana with
`yarn start` (no need to test in serverless as Watcher is not available
there.
2. Navigate to Stack Management -> Watcher and create multiple watches
(the more, the better). Make sure you create watches of different types
(advanced/json or threshold), watches with or without names, etc. There
are different watches and use cases described in the
[documentation](https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher).
Also, adding sample data sets is helpful so that you can get watches to
execute and have values under the "Condition last met" and "Last
checked" columns.
3. After creating various watches, open the table with watches and make
sure that all functionalities work correctly. For example:
- All watches are displayed, check with >10 watches and different page
sizes.
- Sorting works for all columns.
- Search bar works as expected and searching by partial id is supported.
- Deleting watches updates the table correctly.


https://github.com/user-attachments/assets/d0da9c24-7389-481d-8a16-a0d01bda0e80

## Release notes:
This update resolves multiple issues in Watcher UI that were introduced
in 8.18.0, 8.18.1, 9.0.0, and 9.1.0, including the table not displaying
more than 10 watches, an error banner appearing unexpectedly in certain
scenarios, and the search bar functionality not working as expected.
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 16, 2025
Fixes elastic#221820
Fixes elastic#220879

## Summary

This PR reverts elastic#204296 and
elastic#218853 as these PRs caused issues
in the UI due to limitations in the Query Watches API. Therefore, we are
temporarily reverting back to fetching watches through the `.watches`
system index until we have better support from the Query Watches API.

**How to test:**
1. Start Es with `yarn es snapshot --license=trial` and Kibana with
`yarn start` (no need to test in serverless as Watcher is not available
there.
2. Navigate to Stack Management -> Watcher and create multiple watches
(the more, the better). Make sure you create watches of different types
(advanced/json or threshold), watches with or without names, etc. There
are different watches and use cases described in the
[documentation](https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher).
Also, adding sample data sets is helpful so that you can get watches to
execute and have values under the "Condition last met" and "Last
checked" columns.
3. After creating various watches, open the table with watches and make
sure that all functionalities work correctly. For example:
- All watches are displayed, check with >10 watches and different page
sizes.
- Sorting works for all columns.
- Search bar works as expected and searching by partial id is supported.
- Deleting watches updates the table correctly.

https://github.com/user-attachments/assets/d0da9c24-7389-481d-8a16-a0d01bda0e80

## Release notes:
This update resolves multiple issues in Watcher UI that were introduced
in 8.18.0, 8.18.1, 9.0.0, and 9.1.0, including the table not displaying
more than 10 watches, an error banner appearing unexpectedly in certain
scenarios, and the search bar functionality not working as expected.

(cherry picked from commit 5c0b6b0)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 16, 2025
Fixes elastic#221820
Fixes elastic#220879

## Summary

This PR reverts elastic#204296 and
elastic#218853 as these PRs caused issues
in the UI due to limitations in the Query Watches API. Therefore, we are
temporarily reverting back to fetching watches through the `.watches`
system index until we have better support from the Query Watches API.

**How to test:**
1. Start Es with `yarn es snapshot --license=trial` and Kibana with
`yarn start` (no need to test in serverless as Watcher is not available
there.
2. Navigate to Stack Management -> Watcher and create multiple watches
(the more, the better). Make sure you create watches of different types
(advanced/json or threshold), watches with or without names, etc. There
are different watches and use cases described in the
[documentation](https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher).
Also, adding sample data sets is helpful so that you can get watches to
execute and have values under the "Condition last met" and "Last
checked" columns.
3. After creating various watches, open the table with watches and make
sure that all functionalities work correctly. For example:
- All watches are displayed, check with >10 watches and different page
sizes.
- Sorting works for all columns.
- Search bar works as expected and searching by partial id is supported.
- Deleting watches updates the table correctly.

https://github.com/user-attachments/assets/d0da9c24-7389-481d-8a16-a0d01bda0e80

## Release notes:
This update resolves multiple issues in Watcher UI that were introduced
in 8.18.0, 8.18.1, 9.0.0, and 9.1.0, including the table not displaying
more than 10 watches, an error banner appearing unexpectedly in certain
scenarios, and the search bar functionality not working as expected.

(cherry picked from commit 5c0b6b0)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 16, 2025
Fixes elastic#221820
Fixes elastic#220879

## Summary

This PR reverts elastic#204296 and
elastic#218853 as these PRs caused issues
in the UI due to limitations in the Query Watches API. Therefore, we are
temporarily reverting back to fetching watches through the `.watches`
system index until we have better support from the Query Watches API.

**How to test:**
1. Start Es with `yarn es snapshot --license=trial` and Kibana with
`yarn start` (no need to test in serverless as Watcher is not available
there.
2. Navigate to Stack Management -> Watcher and create multiple watches
(the more, the better). Make sure you create watches of different types
(advanced/json or threshold), watches with or without names, etc. There
are different watches and use cases described in the
[documentation](https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher).
Also, adding sample data sets is helpful so that you can get watches to
execute and have values under the "Condition last met" and "Last
checked" columns.
3. After creating various watches, open the table with watches and make
sure that all functionalities work correctly. For example:
- All watches are displayed, check with >10 watches and different page
sizes.
- Sorting works for all columns.
- Search bar works as expected and searching by partial id is supported.
- Deleting watches updates the table correctly.

https://github.com/user-attachments/assets/d0da9c24-7389-481d-8a16-a0d01bda0e80

## Release notes:
This update resolves multiple issues in Watcher UI that were introduced
in 8.18.0, 8.18.1, 9.0.0, and 9.1.0, including the table not displaying
more than 10 watches, an error banner appearing unexpectedly in certain
scenarios, and the search bar functionality not working as expected.

(cherry picked from commit 5c0b6b0)
kibanamachine added a commit that referenced this pull request Jun 16, 2025
…224080)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[Watcher] Revert back to using .watches system index
(#223898)](#223898)

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

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

<!--BACKPORT [{"author":{"name":"Elena
Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-06-16T14:26:24Z","message":"[Watcher]
Revert back to using .watches system index (#223898)\n\nFixes
https://github.com/elastic/kibana/issues/221820\nFixes
https://github.com/elastic/kibana/issues/220879\n\n## Summary\n\nThis PR
reverts #204296
and\nhttps://github.com//pull/218853 as these PRs caused
issues\nin the UI due to limitations in the Query Watches API.
Therefore, we are\ntemporarily reverting back to fetching watches
through the `.watches`\nsystem index until we have better support from
the Query Watches API.\n\n**How to test:**\n1. Start Es with `yarn es
snapshot --license=trial` and Kibana with\n`yarn start` (no need to test
in serverless as Watcher is not available\nthere.\n2. Navigate to Stack
Management -> Watcher and create multiple watches\n(the more, the
better). Make sure you create watches of different types\n(advanced/json
or threshold), watches with or without names, etc. There\nare different
watches and use cases described in
the\n[documentation](https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher).\nAlso,
adding sample data sets is helpful so that you can get watches
to\nexecute and have values under the \"Condition last met\" and
\"Last\nchecked\" columns.\n3. After creating various watches, open the
table with watches and make\nsure that all functionalities work
correctly. For example:\n- All watches are displayed, check with >10
watches and different page\nsizes.\n- Sorting works for all columns.\n-
Search bar works as expected and searching by partial id is
supported.\n- Deleting watches updates the table
correctly.\n\n\nhttps://github.com/user-attachments/assets/d0da9c24-7389-481d-8a16-a0d01bda0e80\n\n##
Release notes:\nThis update resolves multiple issues in Watcher UI that
were introduced\nin 8.18.0, 8.18.1, 9.0.0, and 9.1.0, including the
table not displaying\nmore than 10 watches, an error banner appearing
unexpectedly in certain\nscenarios, and the search bar functionality not
working as
expected.","sha":"5c0b6b0fe7c08b20a6cc540b0e90b8106147b54a","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Watcher","Team:Kibana
Management","backport:version","v9.1.0","v8.19.0","v9.0.3","v8.18.3"],"title":"[Watcher]
Revert back to using .watches system
index","number":223898,"url":"https://github.com/elastic/kibana/pull/223898","mergeCommit":{"message":"[Watcher]
Revert back to using .watches system index (#223898)\n\nFixes
https://github.com/elastic/kibana/issues/221820\nFixes
https://github.com/elastic/kibana/issues/220879\n\n## Summary\n\nThis PR
reverts #204296
and\nhttps://github.com//pull/218853 as these PRs caused
issues\nin the UI due to limitations in the Query Watches API.
Therefore, we are\ntemporarily reverting back to fetching watches
through the `.watches`\nsystem index until we have better support from
the Query Watches API.\n\n**How to test:**\n1. Start Es with `yarn es
snapshot --license=trial` and Kibana with\n`yarn start` (no need to test
in serverless as Watcher is not available\nthere.\n2. Navigate to Stack
Management -> Watcher and create multiple watches\n(the more, the
better). Make sure you create watches of different types\n(advanced/json
or threshold), watches with or without names, etc. There\nare different
watches and use cases described in
the\n[documentation](https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher).\nAlso,
adding sample data sets is helpful so that you can get watches
to\nexecute and have values under the \"Condition last met\" and
\"Last\nchecked\" columns.\n3. After creating various watches, open the
table with watches and make\nsure that all functionalities work
correctly. For example:\n- All watches are displayed, check with >10
watches and different page\nsizes.\n- Sorting works for all columns.\n-
Search bar works as expected and searching by partial id is
supported.\n- Deleting watches updates the table
correctly.\n\n\nhttps://github.com/user-attachments/assets/d0da9c24-7389-481d-8a16-a0d01bda0e80\n\n##
Release notes:\nThis update resolves multiple issues in Watcher UI that
were introduced\nin 8.18.0, 8.18.1, 9.0.0, and 9.1.0, including the
table not displaying\nmore than 10 watches, an error banner appearing
unexpectedly in certain\nscenarios, and the search bar functionality not
working as
expected.","sha":"5c0b6b0fe7c08b20a6cc540b0e90b8106147b54a"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0","8.18"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/223898","number":223898,"mergeCommit":{"message":"[Watcher]
Revert back to using .watches system index (#223898)\n\nFixes
https://github.com/elastic/kibana/issues/221820\nFixes
https://github.com/elastic/kibana/issues/220879\n\n## Summary\n\nThis PR
reverts #204296
and\nhttps://github.com//pull/218853 as these PRs caused
issues\nin the UI due to limitations in the Query Watches API.
Therefore, we are\ntemporarily reverting back to fetching watches
through the `.watches`\nsystem index until we have better support from
the Query Watches API.\n\n**How to test:**\n1. Start Es with `yarn es
snapshot --license=trial` and Kibana with\n`yarn start` (no need to test
in serverless as Watcher is not available\nthere.\n2. Navigate to Stack
Management -> Watcher and create multiple watches\n(the more, the
better). Make sure you create watches of different types\n(advanced/json
or threshold), watches with or without names, etc. There\nare different
watches and use cases described in
the\n[documentation](https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher).\nAlso,
adding sample data sets is helpful so that you can get watches
to\nexecute and have values under the \"Condition last met\" and
\"Last\nchecked\" columns.\n3. After creating various watches, open the
table with watches and make\nsure that all functionalities work
correctly. For example:\n- All watches are displayed, check with >10
watches and different page\nsizes.\n- Sorting works for all columns.\n-
Search bar works as expected and searching by partial id is
supported.\n- Deleting watches updates the table
correctly.\n\n\nhttps://github.com/user-attachments/assets/d0da9c24-7389-481d-8a16-a0d01bda0e80\n\n##
Release notes:\nThis update resolves multiple issues in Watcher UI that
were introduced\nin 8.18.0, 8.18.1, 9.0.0, and 9.1.0, including the
table not displaying\nmore than 10 watches, an error banner appearing
unexpectedly in certain\nscenarios, and the search bar functionality not
working as
expected.","sha":"5c0b6b0fe7c08b20a6cc540b0e90b8106147b54a"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Jun 16, 2025
…#224079)

# Backport

This will backport the following commits from `main` to `8.19`:
- [[Watcher] Revert back to using .watches system index
(#223898)](#223898)

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

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

<!--BACKPORT [{"author":{"name":"Elena
Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-06-16T14:26:24Z","message":"[Watcher]
Revert back to using .watches system index (#223898)\n\nFixes
https://github.com/elastic/kibana/issues/221820\nFixes
https://github.com/elastic/kibana/issues/220879\n\n## Summary\n\nThis PR
reverts #204296
and\nhttps://github.com//pull/218853 as these PRs caused
issues\nin the UI due to limitations in the Query Watches API.
Therefore, we are\ntemporarily reverting back to fetching watches
through the `.watches`\nsystem index until we have better support from
the Query Watches API.\n\n**How to test:**\n1. Start Es with `yarn es
snapshot --license=trial` and Kibana with\n`yarn start` (no need to test
in serverless as Watcher is not available\nthere.\n2. Navigate to Stack
Management -> Watcher and create multiple watches\n(the more, the
better). Make sure you create watches of different types\n(advanced/json
or threshold), watches with or without names, etc. There\nare different
watches and use cases described in
the\n[documentation](https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher).\nAlso,
adding sample data sets is helpful so that you can get watches
to\nexecute and have values under the \"Condition last met\" and
\"Last\nchecked\" columns.\n3. After creating various watches, open the
table with watches and make\nsure that all functionalities work
correctly. For example:\n- All watches are displayed, check with >10
watches and different page\nsizes.\n- Sorting works for all columns.\n-
Search bar works as expected and searching by partial id is
supported.\n- Deleting watches updates the table
correctly.\n\n\nhttps://github.com/user-attachments/assets/d0da9c24-7389-481d-8a16-a0d01bda0e80\n\n##
Release notes:\nThis update resolves multiple issues in Watcher UI that
were introduced\nin 8.18.0, 8.18.1, 9.0.0, and 9.1.0, including the
table not displaying\nmore than 10 watches, an error banner appearing
unexpectedly in certain\nscenarios, and the search bar functionality not
working as
expected.","sha":"5c0b6b0fe7c08b20a6cc540b0e90b8106147b54a","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Watcher","Team:Kibana
Management","backport:version","v9.1.0","v8.19.0","v9.0.3","v8.18.3"],"title":"[Watcher]
Revert back to using .watches system
index","number":223898,"url":"https://github.com/elastic/kibana/pull/223898","mergeCommit":{"message":"[Watcher]
Revert back to using .watches system index (#223898)\n\nFixes
https://github.com/elastic/kibana/issues/221820\nFixes
https://github.com/elastic/kibana/issues/220879\n\n## Summary\n\nThis PR
reverts #204296
and\nhttps://github.com//pull/218853 as these PRs caused
issues\nin the UI due to limitations in the Query Watches API.
Therefore, we are\ntemporarily reverting back to fetching watches
through the `.watches`\nsystem index until we have better support from
the Query Watches API.\n\n**How to test:**\n1. Start Es with `yarn es
snapshot --license=trial` and Kibana with\n`yarn start` (no need to test
in serverless as Watcher is not available\nthere.\n2. Navigate to Stack
Management -> Watcher and create multiple watches\n(the more, the
better). Make sure you create watches of different types\n(advanced/json
or threshold), watches with or without names, etc. There\nare different
watches and use cases described in
the\n[documentation](https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher).\nAlso,
adding sample data sets is helpful so that you can get watches
to\nexecute and have values under the \"Condition last met\" and
\"Last\nchecked\" columns.\n3. After creating various watches, open the
table with watches and make\nsure that all functionalities work
correctly. For example:\n- All watches are displayed, check with >10
watches and different page\nsizes.\n- Sorting works for all columns.\n-
Search bar works as expected and searching by partial id is
supported.\n- Deleting watches updates the table
correctly.\n\n\nhttps://github.com/user-attachments/assets/d0da9c24-7389-481d-8a16-a0d01bda0e80\n\n##
Release notes:\nThis update resolves multiple issues in Watcher UI that
were introduced\nin 8.18.0, 8.18.1, 9.0.0, and 9.1.0, including the
table not displaying\nmore than 10 watches, an error banner appearing
unexpectedly in certain\nscenarios, and the search bar functionality not
working as
expected.","sha":"5c0b6b0fe7c08b20a6cc540b0e90b8106147b54a"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0","8.18"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/223898","number":223898,"mergeCommit":{"message":"[Watcher]
Revert back to using .watches system index (#223898)\n\nFixes
https://github.com/elastic/kibana/issues/221820\nFixes
https://github.com/elastic/kibana/issues/220879\n\n## Summary\n\nThis PR
reverts #204296
and\nhttps://github.com//pull/218853 as these PRs caused
issues\nin the UI due to limitations in the Query Watches API.
Therefore, we are\ntemporarily reverting back to fetching watches
through the `.watches`\nsystem index until we have better support from
the Query Watches API.\n\n**How to test:**\n1. Start Es with `yarn es
snapshot --license=trial` and Kibana with\n`yarn start` (no need to test
in serverless as Watcher is not available\nthere.\n2. Navigate to Stack
Management -> Watcher and create multiple watches\n(the more, the
better). Make sure you create watches of different types\n(advanced/json
or threshold), watches with or without names, etc. There\nare different
watches and use cases described in
the\n[documentation](https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher).\nAlso,
adding sample data sets is helpful so that you can get watches
to\nexecute and have values under the \"Condition last met\" and
\"Last\nchecked\" columns.\n3. After creating various watches, open the
table with watches and make\nsure that all functionalities work
correctly. For example:\n- All watches are displayed, check with >10
watches and different page\nsizes.\n- Sorting works for all columns.\n-
Search bar works as expected and searching by partial id is
supported.\n- Deleting watches updates the table
correctly.\n\n\nhttps://github.com/user-attachments/assets/d0da9c24-7389-481d-8a16-a0d01bda0e80\n\n##
Release notes:\nThis update resolves multiple issues in Watcher UI that
were introduced\nin 8.18.0, 8.18.1, 9.0.0, and 9.1.0, including the
table not displaying\nmore than 10 watches, an error banner appearing
unexpectedly in certain\nscenarios, and the search bar functionality not
working as
expected.","sha":"5c0b6b0fe7c08b20a6cc540b0e90b8106147b54a"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Jun 16, 2025
…#224078)

# Backport

This will backport the following commits from `main` to `8.18`:
- [[Watcher] Revert back to using .watches system index
(#223898)](#223898)

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

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

<!--BACKPORT [{"author":{"name":"Elena
Stoeva","email":"59341489+ElenaStoeva@users.noreply.github.com"},"sourceCommit":{"committedDate":"2025-06-16T14:26:24Z","message":"[Watcher]
Revert back to using .watches system index (#223898)\n\nFixes
https://github.com/elastic/kibana/issues/221820\nFixes
https://github.com/elastic/kibana/issues/220879\n\n## Summary\n\nThis PR
reverts #204296
and\nhttps://github.com//pull/218853 as these PRs caused
issues\nin the UI due to limitations in the Query Watches API.
Therefore, we are\ntemporarily reverting back to fetching watches
through the `.watches`\nsystem index until we have better support from
the Query Watches API.\n\n**How to test:**\n1. Start Es with `yarn es
snapshot --license=trial` and Kibana with\n`yarn start` (no need to test
in serverless as Watcher is not available\nthere.\n2. Navigate to Stack
Management -> Watcher and create multiple watches\n(the more, the
better). Make sure you create watches of different types\n(advanced/json
or threshold), watches with or without names, etc. There\nare different
watches and use cases described in
the\n[documentation](https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher).\nAlso,
adding sample data sets is helpful so that you can get watches
to\nexecute and have values under the \"Condition last met\" and
\"Last\nchecked\" columns.\n3. After creating various watches, open the
table with watches and make\nsure that all functionalities work
correctly. For example:\n- All watches are displayed, check with >10
watches and different page\nsizes.\n- Sorting works for all columns.\n-
Search bar works as expected and searching by partial id is
supported.\n- Deleting watches updates the table
correctly.\n\n\nhttps://github.com/user-attachments/assets/d0da9c24-7389-481d-8a16-a0d01bda0e80\n\n##
Release notes:\nThis update resolves multiple issues in Watcher UI that
were introduced\nin 8.18.0, 8.18.1, 9.0.0, and 9.1.0, including the
table not displaying\nmore than 10 watches, an error banner appearing
unexpectedly in certain\nscenarios, and the search bar functionality not
working as
expected.","sha":"5c0b6b0fe7c08b20a6cc540b0e90b8106147b54a","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Feature:Watcher","Team:Kibana
Management","backport:version","v9.1.0","v8.19.0","v9.0.3","v8.18.3"],"title":"[Watcher]
Revert back to using .watches system
index","number":223898,"url":"https://github.com/elastic/kibana/pull/223898","mergeCommit":{"message":"[Watcher]
Revert back to using .watches system index (#223898)\n\nFixes
https://github.com/elastic/kibana/issues/221820\nFixes
https://github.com/elastic/kibana/issues/220879\n\n## Summary\n\nThis PR
reverts #204296
and\nhttps://github.com//pull/218853 as these PRs caused
issues\nin the UI due to limitations in the Query Watches API.
Therefore, we are\ntemporarily reverting back to fetching watches
through the `.watches`\nsystem index until we have better support from
the Query Watches API.\n\n**How to test:**\n1. Start Es with `yarn es
snapshot --license=trial` and Kibana with\n`yarn start` (no need to test
in serverless as Watcher is not available\nthere.\n2. Navigate to Stack
Management -> Watcher and create multiple watches\n(the more, the
better). Make sure you create watches of different types\n(advanced/json
or threshold), watches with or without names, etc. There\nare different
watches and use cases described in
the\n[documentation](https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher).\nAlso,
adding sample data sets is helpful so that you can get watches
to\nexecute and have values under the \"Condition last met\" and
\"Last\nchecked\" columns.\n3. After creating various watches, open the
table with watches and make\nsure that all functionalities work
correctly. For example:\n- All watches are displayed, check with >10
watches and different page\nsizes.\n- Sorting works for all columns.\n-
Search bar works as expected and searching by partial id is
supported.\n- Deleting watches updates the table
correctly.\n\n\nhttps://github.com/user-attachments/assets/d0da9c24-7389-481d-8a16-a0d01bda0e80\n\n##
Release notes:\nThis update resolves multiple issues in Watcher UI that
were introduced\nin 8.18.0, 8.18.1, 9.0.0, and 9.1.0, including the
table not displaying\nmore than 10 watches, an error banner appearing
unexpectedly in certain\nscenarios, and the search bar functionality not
working as
expected.","sha":"5c0b6b0fe7c08b20a6cc540b0e90b8106147b54a"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0","8.18"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/223898","number":223898,"mergeCommit":{"message":"[Watcher]
Revert back to using .watches system index (#223898)\n\nFixes
https://github.com/elastic/kibana/issues/221820\nFixes
https://github.com/elastic/kibana/issues/220879\n\n## Summary\n\nThis PR
reverts #204296
and\nhttps://github.com//pull/218853 as these PRs caused
issues\nin the UI due to limitations in the Query Watches API.
Therefore, we are\ntemporarily reverting back to fetching watches
through the `.watches`\nsystem index until we have better support from
the Query Watches API.\n\n**How to test:**\n1. Start Es with `yarn es
snapshot --license=trial` and Kibana with\n`yarn start` (no need to test
in serverless as Watcher is not available\nthere.\n2. Navigate to Stack
Management -> Watcher and create multiple watches\n(the more, the
better). Make sure you create watches of different types\n(advanced/json
or threshold), watches with or without names, etc. There\nare different
watches and use cases described in
the\n[documentation](https://www.elastic.co/docs/explore-analyze/alerts-cases/watcher).\nAlso,
adding sample data sets is helpful so that you can get watches
to\nexecute and have values under the \"Condition last met\" and
\"Last\nchecked\" columns.\n3. After creating various watches, open the
table with watches and make\nsure that all functionalities work
correctly. For example:\n- All watches are displayed, check with >10
watches and different page\nsizes.\n- Sorting works for all columns.\n-
Search bar works as expected and searching by partial id is
supported.\n- Deleting watches updates the table
correctly.\n\n\nhttps://github.com/user-attachments/assets/d0da9c24-7389-481d-8a16-a0d01bda0e80\n\n##
Release notes:\nThis update resolves multiple issues in Watcher UI that
were introduced\nin 8.18.0, 8.18.1, 9.0.0, and 9.1.0, including the
table not displaying\nmore than 10 watches, an error banner appearing
unexpectedly in certain\nscenarios, and the search bar functionality not
working as
expected.","sha":"5c0b6b0fe7c08b20a6cc540b0e90b8106147b54a"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Elena Stoeva <59341489+ElenaStoeva@users.noreply.github.com>
@ElenaStoeva ElenaStoeva deleted the watcher/fix-fetched-watches branch January 31, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:Watcher release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// v8.18.1 v8.19.0 v9.0.1 v9.1.0

4 participants