Skip to content

[ES body removal] @elastic/response-ops #204882

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

afharo
Copy link
Member

@afharo afharo commented Dec 19, 2024

Summary

in preparation for 9.0, we're trying to remove the deprecated body param in the ES client.

To make it easier to review, the changes have been split into multiple PRs, trying to group them per code owner as much as possible.

However, unfortunately, due to cross-dependencies, your team may be pinged more than once. Apologies for that additional noise.

What changes?

Nothing changes internally. The ES client already places everything where it should be when performing the request to ES (URL vs. query string vs. body params).

The main change is in the usage: when using the JS ES client, developers don't need to identify what goes in the body and what goes in the URL. All settings are provided at the root level. So, in summary, the change is:

const response = await client.search({
  index: 'test',
-  body: {
    query: {
      match_all: {}
    }
-  }
})

For this reason, enabling the "Hide whitespace changes" option when reviewing is recommended.

Some exceptions to this rule:

  • Bulk APIs replace the body array with operations array (direct replacement)
  • Index Put Settings API replace body array with settings (direct replacement)

@afharo afharo added release_note:skip Skip the PR/issue when compiling release notes backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) labels Dec 19, 2024
@afharo afharo self-assigned this Dec 19, 2024
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

cc @afharo

@afharo afharo marked this pull request as ready for review January 21, 2025 07:16
@afharo afharo requested review from a team as code owners January 21, 2025 07:16
@afharo afharo requested a review from tiansivive January 21, 2025 07:16
@afharo afharo added Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) Team:obs-ux-management Observability Management User Experience Team Team:Entity Analytics Security Entity Analytics Team labels Jan 21, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-management-team (Team:obs-ux-management)

@elasticmachine
Copy link
Contributor

Pinging @elastic/response-ops (Team:ResponseOps)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-entity-analytics (Team:Entity Analytics)

@afharo afharo enabled auto-merge (squash) January 21, 2025 12:20
Copy link
Contributor

@hop-dev hop-dev left a comment

Choose a reason for hiding this comment

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

Thanks for this!

@afharo afharo merged commit 7bb2dad into elastic:main Jan 21, 2025
15 checks passed
@afharo afharo deleted the esclient/remove-deprecated-body/elastic/response-ops branch January 21, 2025 14:10
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.x

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

@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.x Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 204882

Questions ?

Please refer to the Backport tool documentation

afharo added a commit to afharo/kibana that referenced this pull request Jan 21, 2025
(cherry picked from commit 7bb2dad)

# Conflicts:
#	x-pack/solutions/security/plugins/security_solution/server/lib/entity_analytics/risk_score/risk_score_data_client.ts
@afharo
Copy link
Member Author

afharo commented Jan 21, 2025

💚 All backports created successfully

Status Branch Result
8.x

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

Questions ?

Please refer to the Backport tool documentation

afharo added a commit that referenced this pull request Jan 21, 2025
# Backport

This will backport the following commits from `main` to `8.x`:
- [[ES `body` removal] `@elastic/response-ops`
(#204882)](#204882)

<!--- Backport version: 9.6.4 -->

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

<!--BACKPORT [{"author":{"name":"Alejandro Fernández
Haro","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-21T14:10:54Z","message":"[ES
`body` removal] `@elastic/response-ops`
(#204882)","sha":"7bb2dad38f8938569374ce5c99d5e4a2f1ff9b95","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-minor","Team:obs-ux-management","Team:Entity
Analytics"],"title":"[ES `body` removal]
`@elastic/response-ops`","number":204882,"url":"https://github.com/elastic/kibana/pull/204882","mergeCommit":{"message":"[ES
`body` removal] `@elastic/response-ops`
(#204882)","sha":"7bb2dad38f8938569374ce5c99d5e4a2f1ff9b95"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204882","number":204882,"mergeCommit":{"message":"[ES
`body` removal] `@elastic/response-ops`
(#204882)","sha":"7bb2dad38f8938569374ce5c99d5e4a2f1ff9b95"}}]}]
BACKPORT-->
ymao1 added a commit to ymao1/kibana that referenced this pull request Jan 22, 2025
ymao1 added a commit that referenced this pull request Jan 23, 2025
This reverts commit 7bb2dad.

Original PR #204882 caused errors
updating alert data stream index mappings in serverless. This seems to
be a difference in the Elasticsearch client code handling requests with
a body param vs requests without a body param
elastic/elasticsearch-js@a4315a9#diff-07b3475acb306ea63796d4e5cc559c073a63b84c8deeb9948d9ef24fb04c6439
ymao1 added a commit to ymao1/kibana that referenced this pull request Jan 23, 2025
…elastic#207899)

This reverts commit 7bb2dad.

Original PR elastic#204882 caused errors
updating alert data stream index mappings in serverless. This seems to
be a difference in the Elasticsearch client code handling requests with
a body param vs requests without a body param
elastic/elasticsearch-js@a4315a9#diff-07b3475acb306ea63796d4e5cc559c073a63b84c8deeb9948d9ef24fb04c6439

(cherry picked from commit b219962)
ymao1 added a commit that referenced this pull request Jan 23, 2025
…207899) (#208046)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Revert &quot;[ES &#x60;body&#x60; removal]
&#x60;@elastic/response-ops&#x60; (#204882)&quot;
(#207899)](#207899)

<!--- Backport version: 9.6.4 -->

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

<!--BACKPORT [{"author":{"name":"Ying
Mao","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-23T04:47:06Z","message":"Revert
\"[ES `body` removal] `@elastic/response-ops` (#204882)\"
(#207899)\n\nThis reverts commit
7bb2dad.\r\n\r\nOriginal PR
#204882 caused errors\r\nupdating
alert data stream index mappings in serverless. This seems to\r\nbe a
difference in the Elasticsearch client code handling requests with\r\na
body param vs requests without a body
param\r\nhttps://github.com/elastic/elasticsearch-js/commit/a4315a905e818f1aaed39cd3f72b11c65f343842#diff-07b3475acb306ea63796d4e5cc559c073a63b84c8deeb9948d9ef24fb04c6439","sha":"b219962bda1e2183d2d74f3fec2959ebeee52b2e","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Alerting","release_note:skip","Team:ResponseOps","v9.0.0","backport:prev-minor","v8.18.0"],"title":"Revert
\"[ES `body` removal] `@elastic/response-ops`
(#204882)\"","number":207899,"url":"https://github.com/elastic/kibana/pull/207899","mergeCommit":{"message":"Revert
\"[ES `body` removal] `@elastic/response-ops` (#204882)\"
(#207899)\n\nThis reverts commit
7bb2dad.\r\n\r\nOriginal PR
#204882 caused errors\r\nupdating
alert data stream index mappings in serverless. This seems to\r\nbe a
difference in the Elasticsearch client code handling requests with\r\na
body param vs requests without a body
param\r\nhttps://github.com/elastic/elasticsearch-js/commit/a4315a905e818f1aaed39cd3f72b11c65f343842#diff-07b3475acb306ea63796d4e5cc559c073a63b84c8deeb9948d9ef24fb04c6439","sha":"b219962bda1e2183d2d74f3fec2959ebeee52b2e"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/207899","number":207899,"mergeCommit":{"message":"Revert
\"[ES `body` removal] `@elastic/response-ops` (#204882)\"
(#207899)\n\nThis reverts commit
7bb2dad.\r\n\r\nOriginal PR
#204882 caused errors\r\nupdating
alert data stream index mappings in serverless. This seems to\r\nbe a
difference in the Elasticsearch client code handling requests with\r\na
body param vs requests without a body
param\r\nhttps://github.com/elastic/elasticsearch-js/commit/a4315a905e818f1aaed39cd3f72b11c65f343842#diff-07b3475acb306ea63796d4e5cc559c073a63b84c8deeb9948d9ef24fb04c6439","sha":"b219962bda1e2183d2d74f3fec2959ebeee52b2e"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
viduni94 pushed a commit to viduni94/kibana that referenced this pull request Jan 23, 2025
viduni94 pushed a commit to viduni94/kibana that referenced this pull request Jan 23, 2025
…elastic#207899)

This reverts commit 7bb2dad.

Original PR elastic#204882 caused errors
updating alert data stream index mappings in serverless. This seems to
be a difference in the Elasticsearch client code handling requests with
a body param vs requests without a body param
elastic/elasticsearch-js@a4315a9#diff-07b3475acb306ea63796d4e5cc559c073a63b84c8deeb9948d9ef24fb04c6439
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:prev-minor Backport to (9.0) the previous minor version (i.e. one version back from main) elasticsearch-js-9 release_note:skip Skip the PR/issue when compiling release notes Team:Entity Analytics Security Entity Analytics Team Team:obs-ux-management Observability Management User Experience Team Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v8.18.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants