Skip to content

Conversation

@afharo
Copy link
Member

@afharo afharo commented Mar 6, 2025

Summary

Upgrading the ES client to v9.0.0-alpha.4 to test the changes mentioned in elastic/elasticsearch-js#2584

This new version introduces some type changes, most notably, the FieldValue is string | number | boolean | null | undefined instead of any, leading to some new type checks to be implemented (like on aggregation results bucket.key, search_after, and sort options).

On top of that, it adds the new behavior where unknown properties are placed in the body (when the request has a body). If they must be in as a query parameter, they should be placed under the querystring option.

cc @JoshMock

TODO:

  • Stabilize the type errors
  • Address all the query parameters that are now placed in the body (by wrapping them inside the option querystring: {})

I will address // @ts-expect-error [email protected] https://github.com/elastic/elasticsearch-js/issues/2584 in a separate PR to reduce noise.

Related #208776

@afharo afharo self-assigned this Mar 6, 2025
@afharo afharo added Feature:elasticsearch 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 elasticsearch-js-9 Team:Security Platform Security: Auth, Users, Roles, Spaces, Audit Logging, etc t// Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// Team:Fleet Team label for Observability Data Collection Fleet team Team:Detections and Resp Security Detection Response Team Team:Defend Workflows “EDR Workflows” sub-team of Security Solution Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// Team:obs-onboarding Observability Onboarding Team Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// Team:Detection Rule Management Security Detection Rule Management Team Team:Cloud Security Cloud Security team related Team:Detection Engine Security Solution Detection Engine Area Team:Obs AI Assistant Observability AI Assistant Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team Team:obs-ux-management Observability Management User Experience Team Team:Security Generative AI Security Generative AI Team:AI Infra Platform AppEx AI Infrastructure Team t// Feature:Streams This is the label for the Streams Project labels Mar 6, 2025
@afharo afharo force-pushed the es-9.0.0-alpha.4 branch from c2a6ef3 to 6cadeaa Compare March 6, 2025 22:02
Copy link
Member Author

Choose a reason for hiding this comment

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

@JoshMock, here's a missing query parameter in the spec.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, I opened elastic/elasticsearch-specification#3954 to add it (plus a bunch of others that were also missing).

Copy link
Member Author

Choose a reason for hiding this comment

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

require_alias is accepted by the IndexRequest but not the CreateRequest, so I went with the querystring passthrough for both here.

Copy link
Contributor

@baileycash-elastic baileycash-elastic left a comment

Choose a reason for hiding this comment

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

Reviewed on behalf of obs-ux-mgmt:
investigate_app
slo
observability-server (?)

changes make sense to me

query?: estypes.QueryDslQueryContainer;
sort?: estypes.SortOptions[];
_source?: string[] | false;
search_after?: Array<string | number>;
Copy link
Member

Choose a reason for hiding this comment

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

why is this needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

IIRC, because this way we reduce the actual definition of search_after (which includes boolean and null 🤷 )

Copy link
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.

LGTM

@afharo afharo enabled auto-merge (squash) April 3, 2025 19:11
@elasticmachine
Copy link
Contributor

elasticmachine commented Apr 3, 2025

💚 Build Succeeded

  • Buildkite Build
  • Commit: 2d83fc2
  • Kibana Serverless Image: docker.elastic.co/kibana-ci/kibana-serverless:pr-213375-2d83fc2d16b9

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
security 515.6KB 515.6KB +5.0B
Unknown metric groups

ESLint disabled line counts

id before after diff
data 55 56 +1

Total ESLint disabled count

id before after diff
data 56 57 +1

History

cc @afharo

@afharo afharo merged commit b5ad8bc into elastic:main Apr 3, 2025
10 checks passed
@afharo afharo deleted the es-9.0.0-alpha.4 branch April 3, 2025 20:54
afharo added a commit that referenced this pull request Apr 7, 2025
## Summary

Follow up to #213375: The latest
version of the ES client fixed the issue
elastic/elasticsearch-js#2584.

We should be able to remove all usages of `// @ts-expect-error
[email protected]
https://github.com/elastic/elasticsearch-js/issues/2584`.
afharo added a commit that referenced this pull request Apr 7, 2025
afharo added a commit that referenced this pull request Apr 7, 2025
## Summary

Follow up to #213375: The latest
version of the ES client fixed the issue
elastic/elasticsearch-js#2584.

We should be able to remove all usages of `// @ts-expect-error
[email protected]
https://github.com/elastic/elasticsearch-js/issues/2584`.


### 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](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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] 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)
- [ ] 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](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) 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](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...
baileycash-elastic pushed a commit to baileycash-elastic/kibana that referenced this pull request Apr 7, 2025
…c#217219)

## Summary

Follow up to elastic#213375: The latest
version of the ES client fixed the issue
elastic/elasticsearch-js#2584.

We should be able to remove all usages of `// @ts-expect-error
[email protected]
https://github.com/elastic/elasticsearch-js/issues/2584`.


### 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](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)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
- [ ] 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)
- [ ] 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](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) 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](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

### Identify risks

Does this PR introduce any risks? For example, consider risks like hard
to test bugs, performance regression, potential of data loss.

Describe the risk, its severity, and mitigation for each identified
risk. Invite stakeholders and evaluate how to proceed before merging.

- [ ] [See some risk
examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)
- [ ] ...
afharo added a commit that referenced this pull request Apr 7, 2025
## Summary

Follow up to #213375: The latest
version of the ES client fixed the issue
elastic/elasticsearch-js#2584.

We should be able to remove all usages of `// @ts-expect-error
[email protected]
https://github.com/elastic/elasticsearch-js/issues/2584`.


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
afharo added a commit that referenced this pull request Apr 8, 2025
afharo added a commit that referenced this pull request Apr 8, 2025
## Summary

Follow up to #213375: The latest
version of the ES client fixed the issue
elastic/elasticsearch-js#2584.

We should be able to remove all usages of `// @ts-expect-error
[email protected]
https://github.com/elastic/elasticsearch-js/issues/2584`.


### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios
afharo added a commit that referenced this pull request Apr 9, 2025
## Summary

Follow up to #213375: The latest
version of the ES client fixed the issue
elastic/elasticsearch-js#2584.

We should be able to remove all usages of `// @ts-expect-error
[email protected]
https://github.com/elastic/elasticsearch-js/issues/2584`.
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:build-serverless-image elasticsearch-js-9 Feature:elasticsearch Feature:Streams This is the label for the Streams Project release_note:skip Skip the PR/issue when compiling release notes Team:AI Infra Platform AppEx AI Infrastructure Team t// Team:Cloud Security Cloud Security team related Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// Team:Defend Workflows “EDR Workflows” sub-team of Security Solution Team:Detection Engine Security Solution Detection Engine Area Team:Detection Rule Management Security Detection Rule Management Team Team:Detections and Resp Security Detection Response Team Team:Fleet Team label for Observability Data Collection Fleet team Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// Team:Obs AI Assistant Observability AI Assistant Team:obs-onboarding Observability Onboarding Team Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team Team:obs-ux-management Observability Management User Experience Team Team:ResponseOps Platform ResponseOps team (formerly the Cases and Alerting teams) t// Team:Search Team:Security Generative AI Security Generative AI Team:Security Platform Security: Auth, Users, Roles, Spaces, Audit Logging, etc t// Team:SharedUX Platform AppEx-SharedUX (formerly Global Experience) t// Team:Threat Hunting Security Solution Threat Hunting Team v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.