diff --git a/docs/extend/plugin-list.md b/docs/extend/plugin-list.md index 0f2d12064813d..ec1ead3535cf0 100644 --- a/docs/extend/plugin-list.md +++ b/docs/extend/plugin-list.md @@ -23,7 +23,7 @@ mapped_pages: | [console](https://github.com/elastic/kibana/blob/main/src/platform/plugins/shared/console/README.md) | Console provides the user with tools for storing and executing requests against Elasticsearch. | | [contentManagement](https://github.com/elastic/kibana/blob/main/src/platform/plugins/shared/content_management/README.md) | The content management plugin provides functionality to manage content in Kibana. | | [controls](https://github.com/elastic/kibana/blob/main/src/platform/plugins/shared/controls/README.mdx) | The Controls plugin contains Embeddables which can be used to add user-friendly interactivity to apps. | -| [cps](https://github.com/elastic/kibana/blob/main/src/platform/plugins/shared/cps/README.md) | Retrieves project tags from Elasticsearch using the /_project/tags endpoint. | +| [cps](https://github.com/elastic/kibana/blob/main/src/platform/plugins/shared/cps/README.md) | This plugin implements the Cross-Project Search (CPS) logic for Kibana. CPS enables users to search data across multiple Elastic projects as if it were local, without needing to manually specify project names in queries. | | [customIntegrations](https://github.com/elastic/kibana/blob/main/src/platform/plugins/shared/custom_integrations/README.md) | Register add-data cards | | [dashboard](kibana-dashboard-plugin.md) | - Registers the dashboard application. - Adds a dashboard embeddable that can be used in other applications. | | [dashboardMarkdown](https://github.com/elastic/kibana/blob/main/src/platform/plugins/shared/dashboard_markdown/README.md) | This plugin provides a simple Markdown component for embedding editable Markdown content in Kibana dashboards. | diff --git a/src/core/packages/elasticsearch/server-internal/README.md b/src/core/packages/elasticsearch/server-internal/README.md index 38df445ccf465..ab7611e0a3a60 100644 --- a/src/core/packages/elasticsearch/server-internal/README.md +++ b/src/core/packages/elasticsearch/server-internal/README.md @@ -1,3 +1,27 @@ # @kbn/core-elasticsearch-server-internal This package contains the internal types and implementation for Core's server-side elasticsearch service. + +## ElasticsearchService + +The `ElasticsearchService` is one of the Core services (instantiated in `@src/core/packages/root/server-internal/src/server.ts`) that provides connectivity to Elasticsearch for Kibana. + +### Purpose +It manages the lifecycle of Elasticsearch clients, ensures the connection is healthy and compatible, and exposes APIs for plugins to interact with Elasticsearch. + +### Key Features +- **Client Management**: Creates and manages `ClusterClient` instances (e.g., `data` client), providing both internal-user and request-scoped access. +- **Connection Health**: Periodically polls Elasticsearch nodes to verify version compatibility (`esNodesCompatibility$`) and calculates the overall service status (`status$`). +- **Preboot & Setup**: + - Loads configuration (`elasticsearch.hosts`, `username`/`password` or `serviceAccountToken`, etc.). + - Initializes the `AgentManager` for HTTP agent reuse. + - Registers analytics context providers. +- **Startup Checks**: + - Validates the connection to Elasticsearch. + - Verifies that inline scripting is enabled on the cluster. + - Fetches and exposes cluster capabilities. +- **Cross-Project Search (CPS) Handling**: + - Configures the `CpsRequestHandler` based on the `cps.cpsEnabled` configuration flag (read from `coreContext.configService`). + - **Behavior based on `cpsEnabled`**: + - **Enabled (`true`)**: The `CpsRequestHandler` injects `project_routing: '_alias:_origin'` into requests if `project_routing` is missing (unless it's a PIT request, where it is stripped). + - **Disabled (`false`)**: The `CpsRequestHandler` strictly strips any `project_routing` parameter from request bodies to prevent unintended cross-project queries. diff --git a/src/platform/plugins/shared/cps/README.md b/src/platform/plugins/shared/cps/README.md index 856051083ff96..399af8ef1fcf4 100644 --- a/src/platform/plugins/shared/cps/README.md +++ b/src/platform/plugins/shared/cps/README.md @@ -1,6 +1,23 @@ # @kbn/cps -## Holds CPS related logic +## Overview + +This plugin implements the **Cross-Project Search (CPS)** logic for Kibana. CPS enables users to search data across multiple Elastic projects as if it were local, without needing to manually specify project names in queries. + +Kibana acts as a **transparent orchestrator**. It does not execute cross-project searches itself but forwards requests with the appropriate `project_routing` context to Elasticsearch. Elasticsearch then handles the execution, security enforcement, and result aggregation. + +## Client-Side (`public/`) + +- **CPSManager**: The central service for managing CPS state in the browser. + - **Project Routing**: Manages the `projectRouting$` observable (defaults to searching all projects) and allows applications to set/get the current routing. + - **Project Fetching**: Fetches and caches project data using `ProjectFetcher`. + - **UI Access Control**: Determines if the project picker should be editable, read-only, or disabled based on the current application and location (via `getProjectPickerAccess$`). + + +## Server-Side (`server/`) + +- **API Routes**: Registers endpoints like `POST /internal/cps/projects_tags` to retrieve project tags from Elasticsearch (`/_project/tags`), delegating authorization to the scoped Elasticsearch client. +- **Configuration**: Exposes the `cpsEnabled` flag via its setup contract, which is used by other parts of the system (like Core's `ElasticsearchService`) to toggle CPS behaviors. ### API Routes @@ -25,4 +42,4 @@ Retrieves project tags from Elasticsearch using the `/_project/tags` endpoint. **Features:** - Delegates authorization to the scoped Elasticsearch client - Proxies requests to the Elasticsearch `/_project/tags` API -- Returns project tag mappings as key-value pairs \ No newline at end of file +- Returns project tag mappings as key-value pairs