Skip to content
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/changelog/133616.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 133616
summary: Add mode filter to _resolve/index
area: Indices APIs
type: enhancement
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
"type":"boolean",
"description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)",
"default":true
},
"mode": {
"type": "string",
"description": "Filter indices by index mode"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way to specify that the default is "all modes"? If not, are there any other (non-automated) docs where we can document this? I haven't grokked the new docs model for 9x.

Copy link
Contributor Author

@smalyshev smalyshev Aug 28, 2025

Choose a reason for hiding this comment

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

I'm not sure if there's a way to express this in this JSON. There's another spec in elasticsearch-specification repo which I'll update, I think that one is in Typescript and has more expressive power.

Copy link
Member

Choose a reason for hiding this comment

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

You can indeed specify a default. Here's an example:

That said, I'm working on generating rest-api-spec from https://github.com/elastic/elasticsearch-specification and ultimately moving it into the Elasticsearch repo, so that's the important part. And there, defaults are specified with the @server_default annotation.

}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
---
setup:
- do:
indices.create:
index: my-std-index
body:
settings:
number_of_shards: 1
number_of_replicas: 0
aliases:
my-std-alias: { }

# Create a time-series index
- do:
indices.create:
index: my-ts-index
body:
settings:
index.mode: time_series
Copy link
Member

Choose a reason for hiding this comment

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

It looks like we support a comma-delimited list, right? It would be good to exercise that somewhere in the yaml rest test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or you mean an index with double mode when created? I have no idea what would happen then tbh...

number_of_shards: 1
number_of_replicas: 0
index.routing_path: [ "host" ]
mappings:
properties:
"@timestamp":
type: date
host:
type: keyword
time_series_dimension: true
metric:
type: keyword
value:
type: double
aliases:
my-ts-alias: { }
# Create a lookup index
- do:
indices.create:
index: my-lookup-index
body:
settings:
index.mode: lookup
aliases:
my-lookup-alias: { }

---
"resolve index filters by mode":
- requires:
test_runner_features: [ capabilities ]
capabilities:
- method: GET
path: /_resolve/index/*
capabilities: [ mode_filter ]
reason: "Need support for mode filtering in indices.resolve_index"

- do:
indices.resolve_index:
name: 'my-*'
mode: lookup
- length: { indices: 1 }
- match: { indices.0.name: "my-lookup-index" }
- match: { indices.0.mode: "lookup" }
- match: { indices.0.aliases: [ "my-lookup-alias" ] }
- length: { aliases: 1 }
- match: { aliases.0.name: "my-lookup-alias" }
- match: { aliases.0.indices: [ "my-lookup-index" ] }

---
"resolve index filters by mode, multiple modes":
- requires:
test_runner_features: [ capabilities ]
capabilities:
- method: GET
path: /_resolve/index/*
capabilities: [ mode_filter ]
reason: "Need support for mode filtering in indices.resolve_index"

- do:
indices.resolve_index:
name: 'my-*'
mode: time_series,standard
- length: { indices: 2 }
- match: { indices.0.name: "my-std-index" }
- match: { indices.0.mode: "standard" }
- match: { indices.0.aliases: [ "my-std-alias" ] }
- match: { indices.1.name: "my-ts-index" }
- match: { indices.1.mode: "time_series" }
- match: { indices.1.aliases: [ "my-ts-alias" ] }
- length: { aliases: 2 }
- match: { aliases.0.name: "my-std-alias" }
- match: { aliases.0.indices: [ "my-std-index" ] }
- match: { aliases.1.name: "my-ts-alias" }
- match: { aliases.1.indices: [ "my-ts-index" ] }

---
teardown:
- do:
indices.delete:
index: my-std-index
ignore_unavailable: true
- do:
indices.delete:
index: my-ts-index
ignore_unavailable: true
- do:
indices.delete:
index: my-lookup-index
ignore_unavailable: true
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ static TransportVersion def(int id) {
public static final TransportVersion ESQL_SAMPLE_OPERATOR_STATUS = def(9_127_0_00);
public static final TransportVersion PROJECT_RESERVED_STATE_MOVE_TO_REGISTRY = def(9_147_0_00);
public static final TransportVersion STREAMS_ENDPOINT_PARAM_RESTRICTIONS = def(9_148_0_00);
public static final TransportVersion RESOLVE_INDEX_MODE_FILTER = def(9_149_0_00);

/*
* STOP! READ THIS FIRST! No, really,
Expand Down
Loading