Skip to content

Conversation

lukewhiting
Copy link
Contributor

This PR adds the wildcard expansion options available in other cat API's to allow targeting closed and hidden indices.

It also includes a new flag allow_closed that prevents an exception being thrown if targeting a closed index as is the current behaviour. This seemed like the cleanest way to add the new function without breaking BWC.

Fixes ES-5583
Fixes #97023

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@elasticsearchmachine
Copy link
Collaborator

Hi @lukewhiting, I've created a changelog YAML for you.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds wildcard expansion capabilities to the /_cat/segments API to allow targeting closed and hidden indices, bringing it in line with other cat APIs. The main change introduces an allow_closed parameter that prevents exceptions when targeting closed indices while maintaining backward compatibility.

  • Added expand_wildcards and allow_closed parameters to the segments cat API
  • Updated the API to use IndicesOptions for proper wildcard expansion handling
  • Added comprehensive test coverage for the new functionality

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
RestSegmentsAction.java Core implementation adding IndicesOptions support and allow_closed capability
cat.segments.json REST API specification updates for new parameters
10_basic.yml Test coverage for wildcard expansion with closed and hidden indices

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@lukewhiting lukewhiting force-pushed the es-5583-shards-cat-additional-options branch from 8715767 to 2d3f75a Compare October 8, 2025 13:38
@szybia szybia changed the title Add options to include closed and hidden segments in segments cat API Opt-in closed/hidden segments in /_cat/segments Oct 8, 2025
@lukewhiting lukewhiting requested a review from szybia October 9, 2025 08:34
Copy link
Contributor

@szybia szybia left a comment

Choose a reason for hiding this comment

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

lgtm!

spec would be nice, and confused about ClusterStateRequest.indices()

but approving so you can merge on your own time without an extra review

@lukewhiting lukewhiting added the auto-backport Automatically create backport pull requests when merged label Oct 9, 2025
Copy link
Contributor

@szybia szybia left a comment

Choose a reason for hiding this comment

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

nice!

🚢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Automatically create backport pull requests when merged backport :Data Management/CAT APIs Text APIs behind /_cat >enhancement Team:Data Management Meta label for data/management team v8.18.9 v8.19.6 v9.1.6 v9.2.1 v9.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support closed and hidden shards in /_cat/segments
3 participants