Skip to content

Expensive queries are causing unnecessary load and delays on Elasticsearch  #93770

@rudolf

Description

@rudolf

Until #89915 (v7.12.0) saved objects didn't support paging through large result sets. Now that we have _search_after support, plugins who previously paged through "all" results by setting size: 10000 should be refactored to use search after instead.

The problem with creating searches with large batches of 10000 is that it blocks the Elasticsearch thread pool for a long time which negatively impacts the performance of other search queries. Since Kibana started using system indices for the saved objects index in 7.11, this has had a much bigger impact because these searches share a thread pool with the security index. Paging with smaller batches means faster responses per request, allowing the thread pool to interleave Kibana searches with other requests.

In addition to the performance impact on Elasticsearch, large searches also mean large response payloads which blocks the Kibana thread for an extended amount of time. This causes spikes in the event loop delay which impacts the performance of all plugins.

Short term: fix all 10k searches against the saved object indices

The following is a list of plugins performing searches with perPage: 10000. Please audit each occurrence and mark the task as complete with a link to the PR once it has been resolved. These links are based on a quick search, if the linked code isn't searching against a saved objects index with size > 1000 please mark the item as done.

Blocked on #91175 because that will make it significantly easier for teams to address these issues.
Done. Here are docs on the new point-in-time finder.

Medium term

Metadata

Metadata

Assignees

No one assigned

    Labels

    Feature:SearchQuerying infrastructure in KibanaTeam: SecuritySolutionSecurity Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc.Team:CorePlatform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t//Team:DataDiscoveryDiscover, search (data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. t//Team:Detections and RespSecurity Detection Response TeamTeam:MLTeam label for ML (also use :ml) t//Team:ResponseOpsPlatform ResponseOps team (formerly the Cases and Alerting teams) t//impact:mediumAddressing this issue will have a medium level of impact on the quality/strength of our product.loe:smallSmall Level of Effort

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions