Skip to content

Upgrade @elastic/elasticsearch to 9.3.1#253660

Merged
afharo merged 17 commits intomainfrom
upgrade-elasticsearch
Feb 24, 2026
Merged

Upgrade @elastic/elasticsearch to 9.3.1#253660
afharo merged 17 commits intomainfrom
upgrade-elasticsearch

Conversation

@afharo
Copy link
Copy Markdown
Member

@afharo afharo commented Feb 18, 2026

Summary

This PR upgrades @elastic/elasticsearch to 9.3.1.

It triggered many Typescript issues due to the new utility type ExactlyOne<T> used in the Elasticsearch library.

Expand for more details of the changes


Root Cause

The new client version introduces an ExactlyOne<T> utility type for key Elasticsearch types: QueryDslQueryContainer, IngestProcessorContainer, BulkOperationContainer, and AggregationsAggregationContainer. This type creates a union where exactly one property is present and all others are ?: never. When the underlying interface had all-optional properties, the resulting union also includes undefined as a member. This caused three categories of breakage:

  1. keyof resolves to never — Since undefined is part of the union, keyof QueryDslQueryContainer becomes never, breaking any Pick<QueryDslQueryContainer, ...> or keyof QueryDslQueryContainer usage.
  2. Properties are "possibly undefined" — Any variable typed as one of these containers is now possibly undefined, so accessing .bool, .filter, etc. triggers TS18048.
  3. Indexed access failsQueryDslQueryContainer['match_phrase'] fails because the key can't be resolved on a union that includes undefined.

Fix Patterns Applied (124 files, +618 / -403 lines)

Pattern 1: NonNullable<T> for indexed access and keyof

Wherever code used keyof QueryDslQueryContainer or Pick<QueryDslQueryContainer, "bool" | "ids">, it was changed to operate on NonNullable<QueryDslQueryContainer> first to strip undefined from the union:

// Before
type AlertsQueryType = Pick<QueryDslQueryContainer, "bool" | "ids">;

// After
type AlertsQueryType = Partial<Pick<NonNullable<QueryDslQueryContainer>, "bool" | "ids">>;

This pattern was applied in alerting types, rule registry, alerts-table, kbn-grouping, task manager, kbn-streamlang, and kbn-streams-schema.

Pattern 2: Optional chaining for "possibly undefined" access

In source files where a variable typed as QueryDslQueryContainer (or similar) was accessed, optional chaining was added:

// Before
kueryQuery.bool
// After
kueryQuery?.bool

Applied in kbn-es-query, saved-objects migration, aiops, ML, observability, security solution, and many others.

Pattern 3: NonNullable<T> in type casts

When constructing objects and casting them as ESFilter (which maps to QueryDslQueryContainer), the cast was changed to as NonNullable<ESFilter> to prevent TypeScript from treating the freshly-constructed value as possibly undefined:

// Before
const filter = { bool: { ... } } as ESFilter;
// After
const filter = { bool: { ... } } as NonNullable<ESFilter>;

Applied in threshold bucket filters, alert conflict resolver, session index, etc.

Pattern 4: NonNullable<T>['prop'] for property type extraction

Direct indexed access on the container types was replaced with NonNullable wrapping:

// Before
estypes.QueryDslQueryContainer['match_phrase']
// After
NonNullable<estypes.QueryDslQueryContainer>['match_phrase']

Applied in phrase_filter.ts, range_filter.ts, and filter building utilities.

Pattern 5: Non-null assertions in test files

In test files where values from toElasticsearchQuery() or bulk operations were known to be defined, non-null assertions (!) were added rather than full null-checking:

// Before
expect(result.bool.should).toEqual(...)
// After
expect(result!.bool!.should).toEqual(...)

Applied across kbn-es-query tests, migration helpers tests, ML inference pipeline tests, math processor tests, etc.

Pattern 6: Structural type replacements

Where Extract<BulkOperationContainer, { delete: unknown }> resolved to never, the parameter type was replaced with a direct structural type:

// Before
Array<Extract<BulkOperationContainer, { delete: unknown }>>
// After
Array<{ delete: BulkDeleteOperation }>

Applied in security session_index.ts.


Summary of the changes by Area

Area Files Changed Key Changes
kbn-es-query (core query/filter lib) ~12 NonNullable for type access, optional chaining, test assertions
Saved Objects migration 3 Optional chaining on excludeOnUpgradeQuery.bool
Alerting / Rule Registry ~8 Partial<Pick<NonNullable<...>>> pattern for query types
ML / Aiops ~25 Default query types, optional chaining, cast adjustments
Security Solution ~10 Threshold filters, network DSL, alert bulk actions
Observability (Infra, SLO, UX, APM) ~15 Query construction, alert summaries, web vitals queries
Streams / kbn-streamlang ~6 keyof NonNullable<IngestProcessorContainer>, null checks
Enterprise Search ~8 ML inference pipeline processor types
Task Manager 1 Pick<NonNullable<...>> for pinned/bool query types
Other (Cases, Transform, Vega, etc.) ~20+ Various combinations of the above patterns

Checklist

Check the PR satisfies following conditions.

Reviewers should verify this PR satisfies this list as well.

  • Any text added follows EUI's writing guidelines, uses sentence case text and includes i18n support
  • Documentation was added for features that require explanation or tutorials
  • Unit or functional tests were updated or added to match the most common scenarios
  • If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the docker list
  • This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The release_note:breaking label should be applied in these situations.
  • Flaky Test Runner was used on any tests changed
  • The PR description includes the appropriate Release Notes section, and the correct release_note:* label is applied per the guidelines
  • Review the backport guidelines and apply applicable backport:* labels.

@afharo afharo self-assigned this Feb 18, 2026
@afharo afharo added Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Feb 18, 2026
@afharo afharo force-pushed the upgrade-elasticsearch branch from 29af322 to 5eb5276 Compare February 18, 2026 09:33
@afharo afharo linked an issue Feb 18, 2026 that may be closed by this pull request
@afharo afharo marked this pull request as ready for review February 19, 2026 12:26
@afharo afharo requested review from a team as code owners February 19, 2026 12:26
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-core (Team:Core)

@afharo afharo requested review from a team as code owners February 19, 2026 12:26
Copy link
Copy Markdown
Contributor

@dhurley14 dhurley14 left a comment

Choose a reason for hiding this comment

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

code review only LGTM @security-detection-engine

Comment on lines -42 to -44
if (term.field != null) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
(filter.bool!.filter as ESFilter[]).push({
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

Copy link
Copy Markdown
Contributor

@pmuellr pmuellr left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for removing the hallucinations! :-)

@rgodfrey-elastic rgodfrey-elastic removed their request for review February 20, 2026 22:07
// This can be used to apply any post-processing directly to the ingest pipeline processors.
export const applyPostProcessing = (processors: IngestProcessorContainer[]) => {
return processors.map((processor) => {
if (processor == null) return processor;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Kerry350 It looks like the IngestProcessorContainer type has changed in @elastic/elasticsearch. Does this change (and the others in this PR) make sense to you or would it be better to use NonNullable<IngestProcessorContainer> type instead of IngestProcessorContainer as is so that we don't need to guard against null across the codebase?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Using NonNullable<IngestProcessorContainer> makes sense to me rather than repeated guards 👌

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I noticed that adding NonNullable<IngestProcessorContainer> to this file would cause many changes downstream: the pipe in index.ts would lead to changing the output type of conversions.ts, which would complain for many of the process*Processor methods inside the flatMap loop.

Instead, this solution simplifies the changes: b52b911

WDYT?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That looks okay, I'll approve 👌

Copy link
Copy Markdown
Contributor

@smith smith left a comment

Choose a reason for hiding this comment

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

obs-presentation changes LGTM (re-review, code review only).

Previous comments addressed — alerts_overview.tsx and alerts_tab_badge.tsx changes correctly reverted.

Remaining obs changes are clean: change_point casts removed (now properly typed in 9.3.1), standard optional chaining and NonNullable patterns applied consistently across infra, SLO, UX, observability_agent_builder, and observability_ai_assistant_app.

Copy link
Copy Markdown
Member

@ashokaditya ashokaditya left a comment

Choose a reason for hiding this comment

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

Changes to x-pack/solutions/security/plugins/security_solution/common/endpoint/utils/endpoint_metadata_filter.test.ts LGTM.

Copy link
Copy Markdown
Contributor

@kdelemme kdelemme left a comment

Choose a reason for hiding this comment

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

actionable-obs code change lgtm

@pquentin pquentin removed their request for review February 24, 2026 06:34
@afharo
Copy link
Copy Markdown
Member Author

afharo commented Feb 24, 2026

@elasticmachine merge upstream

Copy link
Copy Markdown
Contributor

@miltonhultgren miltonhultgren left a comment

Choose a reason for hiding this comment

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

SigEvents change (removing // @ts-expect-error) LGTM

@elasticmachine
Copy link
Copy Markdown
Contributor

elasticmachine commented Feb 24, 2026

💛 Build succeeded, but was flaky

  • Buildkite Build
  • Commit: dfcc551
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-253660-dfcc5511840a

Failed CI Steps

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
aiops 521.2KB 521.3KB +78.0B
cases 1.6MB 1.6MB +64.0B
datasetQuality 577.4KB 577.4KB +6.0B
dataVisualizer 600.6KB 600.6KB +44.0B
enterpriseSearch 953.2KB 953.3KB +15.0B
ml 5.8MB 5.8MB +73.0B
searchIndices 215.3KB 215.4KB +37.0B
searchPlayground 246.8KB 246.8KB +37.0B
streamsApp 1.7MB 1.7MB +12.0B
ux 134.8KB 135.1KB +342.0B
total +708.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
kbnUiSharedDeps-srcJs 4.7MB 4.7MB +15.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
securitySolution 718 717 -1

Total ESLint disabled count

id before after diff
securitySolution 823 822 -1

History

cc @afharo

@afharo afharo merged commit 42fab16 into main Feb 24, 2026
18 checks passed
@afharo afharo deleted the upgrade-elasticsearch branch February 24, 2026 10:30
mbondyra added a commit to rgodfrey-elastic/kibana that referenced this pull request Feb 24, 2026
…ps-config-rebase

* commit 'f135f030951237c5e9b0251931441aee3121b31d': (163 commits)
  [CPS] Support data view requests and do not sanitize project_routing in data plugin/resolve indices  (elastic#253654)
  [One Workflow] Execute workflow from historical (elastic#253396)
  [streams][background tasks] gracefully handle non existing stream (elastic#254683)
  [Lens API] Waffle/Mosaic get green as a default color (elastic#254304)
  [Security Solution] Remove prebuilt rules customization callout on Rule Management page (elastic#254386)
  [Workflows] support passing attachments to run_agent step (elastic#251291)
  [One Discover][Logs UX] Update OpenTelemetry Semantic Conventions (elastic#254367)
  [kbn-es] Add --docker flag to yarn es snapshot (elastic#254306)
  [Workplace AI] Remove Data Source Config (elastic#254521)
  [Entity Store v2] Add CRUD API (elastic#252052)
  [CI] Increase type checking machine (elastic#254676)
  [main] Sync bundled packages with Package Storage (elastic#254232)
  Skip flaky test elastic#254625 (elastic#254662)
  Upgrade `@elastic/elasticsearch` to 9.3.1 (elastic#253660)
  [One Workflow] Migrate http step to new connector (elastic#249004)
  [Entity Store] Store EUID Scripts (elastic#254515)
  [APM] Fix Otel missing fields undefined errors (elastic#254271)
  [Console] Add support for documentation links on Serverless (elastic#254489)
  Create edit ILM flow (elastic#253393)
  [Agent Builder] Mid term: minimal recommended model set elastic#12875 (elastic#254560)
  ...
nreese pushed a commit to nreese/kibana that referenced this pull request Feb 25, 2026
## Summary

This PR upgrades `@elastic/elasticsearch` to **9.3.1**.

It triggered many Typescript issues due to the new utility type
`ExactlyOne<T>` used in the Elasticsearch library.

<details><summary>Expand for more details of the changes</summary>
<p>

---

## Root Cause

The new client version introduces an `ExactlyOne<T>` utility type for
key Elasticsearch types: `QueryDslQueryContainer`,
`IngestProcessorContainer`, `BulkOperationContainer`, and
`AggregationsAggregationContainer`. This type creates a union where
exactly one property is present and all others are `?: never`. When the
underlying interface had all-optional properties, the resulting union
also includes `undefined` as a member. This caused three categories of
breakage:

1. **`keyof` resolves to `never`** — Since `undefined` is part of the
union, `keyof QueryDslQueryContainer` becomes `never`, breaking any
`Pick<QueryDslQueryContainer, ...>` or `keyof QueryDslQueryContainer`
usage.
2. **Properties are "possibly undefined"** — Any variable typed as one
of these containers is now possibly `undefined`, so accessing `.bool`,
`.filter`, etc. triggers `TS18048`.
3. **Indexed access fails** — `QueryDslQueryContainer['match_phrase']`
fails because the key can't be resolved on a union that includes
`undefined`.

---

## Fix Patterns Applied (124 files, +618 / -403 lines)

### Pattern 1: `NonNullable<T>` for indexed access and `keyof`
Wherever code used `keyof QueryDslQueryContainer` or
`Pick<QueryDslQueryContainer, "bool" | "ids">`, it was changed to
operate on `NonNullable<QueryDslQueryContainer>` first to strip
`undefined` from the union:

```typescript
// Before
type AlertsQueryType = Pick<QueryDslQueryContainer, "bool" | "ids">;

// After
type AlertsQueryType = Partial<Pick<NonNullable<QueryDslQueryContainer>, "bool" | "ids">>;
```

This pattern was applied in **alerting types**, **rule registry**,
**alerts-table**, **kbn-grouping**, **task manager**,
**kbn-streamlang**, and **kbn-streams-schema**.

### Pattern 2: Optional chaining for "possibly undefined" access
In source files where a variable typed as `QueryDslQueryContainer` (or
similar) was accessed, optional chaining was added:

```typescript
// Before
kueryQuery.bool
// After
kueryQuery?.bool
```

Applied in **kbn-es-query**, **saved-objects migration**, **aiops**,
**ML**, **observability**, **security solution**, and many others.

### Pattern 3: `NonNullable<T>` in type casts
When constructing objects and casting them `as ESFilter` (which maps to
`QueryDslQueryContainer`), the cast was changed to `as
NonNullable<ESFilter>` to prevent TypeScript from treating the
freshly-constructed value as possibly `undefined`:

```typescript
// Before
const filter = { bool: { ... } } as ESFilter;
// After
const filter = { bool: { ... } } as NonNullable<ESFilter>;
```

Applied in **threshold bucket filters**, **alert conflict resolver**,
**session index**, etc.

### Pattern 4: `NonNullable<T>['prop']` for property type extraction
Direct indexed access on the container types was replaced with
`NonNullable` wrapping:

```typescript
// Before
estypes.QueryDslQueryContainer['match_phrase']
// After
NonNullable<estypes.QueryDslQueryContainer>['match_phrase']
```

Applied in **phrase_filter.ts**, **range_filter.ts**, and filter
building utilities.

### Pattern 5: Non-null assertions in test files
In test files where values from `toElasticsearchQuery()` or bulk
operations were known to be defined, non-null assertions (`!`) were
added rather than full null-checking:

```typescript
// Before
expect(result.bool.should).toEqual(...)
// After
expect(result!.bool!.should).toEqual(...)
```

Applied across **kbn-es-query tests**, **migration helpers tests**, **ML
inference pipeline tests**, **math processor tests**, etc.

### Pattern 6: Structural type replacements
Where `Extract<BulkOperationContainer, { delete: unknown }>` resolved to
`never`, the parameter type was replaced with a direct structural type:

```typescript
// Before
Array<Extract<BulkOperationContainer, { delete: unknown }>>
// After
Array<{ delete: BulkDeleteOperation }>
```

Applied in **security session_index.ts**.

---


</p>
</details> 


## Summary of the changes by Area

| Area | Files Changed | Key Changes |
|------|--------------|-------------|
| **kbn-es-query** (core query/filter lib) | ~12 | `NonNullable` for
type access, optional chaining, test assertions |
| **Saved Objects migration** | 3 | Optional chaining on
`excludeOnUpgradeQuery.bool` |
| **Alerting / Rule Registry** | ~8 | `Partial<Pick<NonNullable<...>>>`
pattern for query types |
| **ML / Aiops** | ~25 | Default query types, optional chaining, cast
adjustments |
| **Security Solution** | ~10 | Threshold filters, network DSL, alert
bulk actions |
| **Observability (Infra, SLO, UX, APM)** | ~15 | Query construction,
alert summaries, web vitals queries |
| **Streams / kbn-streamlang** | ~6 | `keyof
NonNullable<IngestProcessorContainer>`, null checks |
| **Enterprise Search** | ~8 | ML inference pipeline processor types |
| **Task Manager** | 1 | `Pick<NonNullable<...>>` for pinned/bool query
types |
| **Other (Cases, Transform, Vega, etc.)** | ~20+ | Various combinations
of the above patterns |


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [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
- [x] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
qn895 pushed a commit to qn895/kibana that referenced this pull request Mar 11, 2026
## Summary

This PR upgrades `@elastic/elasticsearch` to **9.3.1**.

It triggered many Typescript issues due to the new utility type
`ExactlyOne<T>` used in the Elasticsearch library.

<details><summary>Expand for more details of the changes</summary>
<p>

---

## Root Cause

The new client version introduces an `ExactlyOne<T>` utility type for
key Elasticsearch types: `QueryDslQueryContainer`,
`IngestProcessorContainer`, `BulkOperationContainer`, and
`AggregationsAggregationContainer`. This type creates a union where
exactly one property is present and all others are `?: never`. When the
underlying interface had all-optional properties, the resulting union
also includes `undefined` as a member. This caused three categories of
breakage:

1. **`keyof` resolves to `never`** — Since `undefined` is part of the
union, `keyof QueryDslQueryContainer` becomes `never`, breaking any
`Pick<QueryDslQueryContainer, ...>` or `keyof QueryDslQueryContainer`
usage.
2. **Properties are "possibly undefined"** — Any variable typed as one
of these containers is now possibly `undefined`, so accessing `.bool`,
`.filter`, etc. triggers `TS18048`.
3. **Indexed access fails** — `QueryDslQueryContainer['match_phrase']`
fails because the key can't be resolved on a union that includes
`undefined`.

---

## Fix Patterns Applied (124 files, +618 / -403 lines)

### Pattern 1: `NonNullable<T>` for indexed access and `keyof`
Wherever code used `keyof QueryDslQueryContainer` or
`Pick<QueryDslQueryContainer, "bool" | "ids">`, it was changed to
operate on `NonNullable<QueryDslQueryContainer>` first to strip
`undefined` from the union:

```typescript
// Before
type AlertsQueryType = Pick<QueryDslQueryContainer, "bool" | "ids">;

// After
type AlertsQueryType = Partial<Pick<NonNullable<QueryDslQueryContainer>, "bool" | "ids">>;
```

This pattern was applied in **alerting types**, **rule registry**,
**alerts-table**, **kbn-grouping**, **task manager**,
**kbn-streamlang**, and **kbn-streams-schema**.

### Pattern 2: Optional chaining for "possibly undefined" access
In source files where a variable typed as `QueryDslQueryContainer` (or
similar) was accessed, optional chaining was added:

```typescript
// Before
kueryQuery.bool
// After
kueryQuery?.bool
```

Applied in **kbn-es-query**, **saved-objects migration**, **aiops**,
**ML**, **observability**, **security solution**, and many others.

### Pattern 3: `NonNullable<T>` in type casts
When constructing objects and casting them `as ESFilter` (which maps to
`QueryDslQueryContainer`), the cast was changed to `as
NonNullable<ESFilter>` to prevent TypeScript from treating the
freshly-constructed value as possibly `undefined`:

```typescript
// Before
const filter = { bool: { ... } } as ESFilter;
// After
const filter = { bool: { ... } } as NonNullable<ESFilter>;
```

Applied in **threshold bucket filters**, **alert conflict resolver**,
**session index**, etc.

### Pattern 4: `NonNullable<T>['prop']` for property type extraction
Direct indexed access on the container types was replaced with
`NonNullable` wrapping:

```typescript
// Before
estypes.QueryDslQueryContainer['match_phrase']
// After
NonNullable<estypes.QueryDslQueryContainer>['match_phrase']
```

Applied in **phrase_filter.ts**, **range_filter.ts**, and filter
building utilities.

### Pattern 5: Non-null assertions in test files
In test files where values from `toElasticsearchQuery()` or bulk
operations were known to be defined, non-null assertions (`!`) were
added rather than full null-checking:

```typescript
// Before
expect(result.bool.should).toEqual(...)
// After
expect(result!.bool!.should).toEqual(...)
```

Applied across **kbn-es-query tests**, **migration helpers tests**, **ML
inference pipeline tests**, **math processor tests**, etc.

### Pattern 6: Structural type replacements
Where `Extract<BulkOperationContainer, { delete: unknown }>` resolved to
`never`, the parameter type was replaced with a direct structural type:

```typescript
// Before
Array<Extract<BulkOperationContainer, { delete: unknown }>>
// After
Array<{ delete: BulkDeleteOperation }>
```

Applied in **security session_index.ts**.

---


</p>
</details> 


## Summary of the changes by Area

| Area | Files Changed | Key Changes |
|------|--------------|-------------|
| **kbn-es-query** (core query/filter lib) | ~12 | `NonNullable` for
type access, optional chaining, test assertions |
| **Saved Objects migration** | 3 | Optional chaining on
`excludeOnUpgradeQuery.bool` |
| **Alerting / Rule Registry** | ~8 | `Partial<Pick<NonNullable<...>>>`
pattern for query types |
| **ML / Aiops** | ~25 | Default query types, optional chaining, cast
adjustments |
| **Security Solution** | ~10 | Threshold filters, network DSL, alert
bulk actions |
| **Observability (Infra, SLO, UX, APM)** | ~15 | Query construction,
alert summaries, web vitals queries |
| **Streams / kbn-streamlang** | ~6 | `keyof
NonNullable<IngestProcessorContainer>`, null checks |
| **Enterprise Search** | ~8 | ML inference pipeline processor types |
| **Task Manager** | 1 | `Pick<NonNullable<...>>` for pinned/bool query
types |
| **Other (Cases, Transform, Vega, etc.)** | ~20+ | Various combinations
of the above patterns |


### Checklist

Check the PR satisfies following conditions. 

Reviewers should verify this PR satisfies this list as well.

- [x] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [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
- [x] If a plugin configuration key changed, check if it needs to be
allowlisted in the cloud and added to the [docker
list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)
- [x] This was checked for breaking HTTP API changes, and any breaking
changes have been approved by the breaking-change committee. The
`release_note:breaking` label should be applied in these situations.
- [x] [Flaky Test
Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was
used on any tests changed
- [x] The PR description includes the appropriate Release Notes section,
and the correct `release_note:*` label is applied per the
[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)
- [x] Review the [backport
guidelines](https://docs.google.com/document/d/1VyN5k91e5OVumlc0Gb9RPa3h1ewuPE705nRtioPiTvY/edit?usp=sharing)
and apply applicable `backport:*` labels.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Marta Bondyra <4283304+mbondyra@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting ci:project-deploy-observability Create an Observability project release_note:skip Skip the PR/issue when compiling release notes Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// Team:obs-presentation Focus: APM UI, Infra UI, Hosts UI, Universal Profiling, Obs Overview and left Navigation Team:obs-ux-management v9.4.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade @elastic/elasticsearch to 9.3.1