Skip to content

Conversation

DaveCTurner
Copy link
Contributor

@DaveCTurner DaveCTurner commented Sep 16, 2025

Describes the ?bytes= and ?time= parameters which are accepted by
all the GET _cat/... APIs.

Describes the `?bytes=`, `?size=` and `?time=` parameters which are
accepted by all the `GET _cat/...` APIs.
@DaveCTurner DaveCTurner requested a review from a team as a code owner September 16, 2025 15:04
@DaveCTurner DaveCTurner added specification skip-backport This pull request should not be backported labels Sep 16, 2025
* If given, size values are rendered as an integer with no suffix, representing the value of the column in the chosen unit.
* Values that are not an exact multiple of the chosen unit are rounded down.
*/
size?: '' | 'k' | 'm' | 'g' | 't' | 'p'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what to do with this one - it doesn't seem to be defined anywhere yet.

Copy link
Member

Choose a reason for hiding this comment

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

I would add a new UnitSize enum in _types/common.ts next to Bytes.

@DaveCTurner
Copy link
Contributor Author

It's telling me to run prettier but I do not have this tool.

Also this seems problematic:

Error: ../output/typescript/types.ts(8097,18): error TS2430: Interface 'CatMlTrainedModelsRequest' incorrectly extends interface 'CatCatRequestBase'.
  Types of property 'size' are incompatible.
    Type 'number' is not assignable to type '"" | "p" | "g" | "m" | "k" | "t"'.
Error: ../output/typescript/types.ts(9032,18): error TS2430: Interface 'CatTransformsRequest' incorrectly extends interface 'CatCatRequestBase'.
  Types of property 'size' are incompatible.
    Type 'number' is not assignable to type '"" | "p" | "g" | "m" | "k" | "t"'.
make: *** [Makefile:12: generate] Error 2

The ?size parameter is indeed overloaded for these APIs. Not sure what to do about that.

@pquentin
Copy link
Member

It's telling me to run prettier but I do not have this tool.

make contrib usually takes care of it, but it currently fails due to the size issue, so I've used make spec-format-fix instead.

The ?size parameter is indeed overloaded for these APIs. Not sure what to do about that.

The last time we had such an issue, we decided to remove the affected parameter from the common cat parameters and explicitly place it in each API where it made sense. Doing this will be easier than fighting the TypeScript compiler which correctly errors out here.

DaveCTurner added a commit to DaveCTurner/elasticsearch that referenced this pull request Sep 17, 2025
@DaveCTurner
Copy link
Contributor Author

DaveCTurner commented Sep 17, 2025

Ok I looked more deeply and I think the ?size parameter is a complete no-op, so I've just dropped it here.

Edit: also opened elastic/elasticsearch#134871 to drop the SizeValue concept entirely.

Copy link
Contributor

Following you can find the validation changes against the target branch for the APIs.

No changes detected.

You can validate these APIs yourself by using the make validate target.

Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

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

Thank you! LGTM.

@DaveCTurner
Copy link
Contributor Author

Thanks Quentin. Do I need to wait for elastic/elasticsearch#134870 to land and then adjust things here, or is it ok to merge this first?

@pquentin
Copy link
Member

It's OK to merge this first. We have automation to sync the rest-api-spec from Elasticsearch to the specification that will remove the errors. (I did check that the changes were the same in both places.)

@pquentin pquentin added backport 8.19 backport 9.1 and removed skip-backport This pull request should not be backported labels Sep 17, 2025
@DaveCTurner DaveCTurner merged commit e22c101 into main Sep 17, 2025
12 of 13 checks passed
@DaveCTurner DaveCTurner deleted the 2025/09/16/common-cat-unit-parameters branch September 17, 2025 08:01
Copy link
Contributor

The backport to 8.19 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-8.19 8.19
# Navigate to the new working tree
cd .worktrees/backport-8.19
# Create a new branch
git switch --create backport-5298-to-8.19
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e22c10134264a91aca0f736153460a3e988c27b5
# Push it to GitHub
git push --set-upstream origin backport-5298-to-8.19
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-8.19

Then, create a pull request where the base branch is 8.19 and the compare/head branch is backport-5298-to-8.19.

Copy link
Contributor

The backport to 9.1 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-9.1 9.1
# Navigate to the new working tree
cd .worktrees/backport-9.1
# Create a new branch
git switch --create backport-5298-to-9.1
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 e22c10134264a91aca0f736153460a3e988c27b5
# Push it to GitHub
git push --set-upstream origin backport-5298-to-9.1
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-9.1

Then, create a pull request where the base branch is 9.1 and the compare/head branch is backport-5298-to-9.1.

DaveCTurner added a commit that referenced this pull request Sep 17, 2025
Describes the `?bytes=` and `?time=` parameters which are accepted by
all the `GET _cat/...` APIs.
DaveCTurner added a commit that referenced this pull request Sep 17, 2025
Describes the `?bytes=` and `?time=` parameters which are accepted by
all the `GET _cat/...` APIs.

Backport of #5298 to `9.1`
pquentin pushed a commit that referenced this pull request Sep 17, 2025
Describes the `?bytes=` and `?time=` parameters which are accepted by
all the `GET _cat/...` APIs.

Backport of #5298 to `9.1`
pquentin pushed a commit that referenced this pull request Sep 17, 2025
Describes the `?bytes=` and `?time=` parameters which are accepted by
all the `GET _cat/...` APIs.
pquentin added a commit to elastic/elasticsearch that referenced this pull request Sep 18, 2025
pquentin pushed a commit to pquentin/elasticsearch that referenced this pull request Sep 18, 2025
Relates elastic/elasticsearch-specification#5298

Co-authored-by: Quentin Pradet <[email protected]>
(cherry picked from commit d0ea79a)

# Conflicts:
#	rest-api-spec/src/main/resources/rest-api-spec/api/cat.aliases.json
pquentin pushed a commit to pquentin/elasticsearch that referenced this pull request Sep 18, 2025
Relates elastic/elasticsearch-specification#5298

Co-authored-by: Quentin Pradet <[email protected]>
(cherry picked from commit d0ea79a)

# Conflicts:
#	rest-api-spec/src/main/resources/rest-api-spec/api/cat.aliases.json
gmjehovich pushed a commit to gmjehovich/elasticsearch that referenced this pull request Sep 18, 2025
pquentin added a commit to elastic/elasticsearch that referenced this pull request Sep 19, 2025
Relates elastic/elasticsearch-specification#5298

Co-authored-by: Quentin Pradet <[email protected]>
(cherry picked from commit d0ea79a)

# Conflicts:
#	rest-api-spec/src/main/resources/rest-api-spec/api/cat.aliases.json

Co-authored-by: David Turner <[email protected]>
pquentin added a commit to elastic/elasticsearch that referenced this pull request Sep 19, 2025
Relates elastic/elasticsearch-specification#5298

Co-authored-by: Quentin Pradet <[email protected]>
(cherry picked from commit d0ea79a)

# Conflicts:
#	rest-api-spec/src/main/resources/rest-api-spec/api/cat.aliases.json

Co-authored-by: David Turner <[email protected]>
pquentin pushed a commit that referenced this pull request Oct 7, 2025
Describes the `?bytes=` and `?time=` parameters which are accepted by
all the `GET _cat/...` APIs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants