Skip to content
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

Add selector syntax to index expressions #118614

Merged
merged 113 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
ca7c90a
Remove FailureOptions from IndicesOptions
jbaiera Aug 14, 2024
2d42454
Fix breaking tests and sources beyond server project.
jbaiera Aug 15, 2024
b03e21c
Add selector options to indices options
jbaiera Sep 7, 2024
ca36ddc
Add a way to look up suffixes by name
jbaiera Sep 8, 2024
72ab8ec
Add logic to parse out selectors.
jbaiera Sep 8, 2024
20fa270
Completely resolve selectors into expression resolution. Update tests…
jbaiera Sep 11, 2024
402be1e
Add tests for SelectorResolver
jbaiera Sep 12, 2024
f5c7138
Add additional tests to WildcardExpressionResolverTests
jbaiera Sep 13, 2024
1092875
Refactor: Change selector string into enum
jbaiera Sep 13, 2024
97ed857
Refactor: Change "indexAbstraction" to "resource" inside ResolvedExpr…
jbaiera Sep 13, 2024
e4e924a
Integrate the resolveExpressions signature change.
jbaiera Sep 18, 2024
70ff223
Fix rebase issues
jbaiera Sep 18, 2024
4931386
Refactor: Move Selectors to a new class
jbaiera Sep 20, 2024
2b78539
Refactor: DownsampleAction should use the options provided by factory…
jbaiera Sep 20, 2024
94f9b6f
Merge branch 'main' into failure-store-naming-scheme
jbaiera Sep 25, 2024
c09c73d
Update $ separator to :: separator
jbaiera Oct 1, 2024
21a3037
Match up IndicesOptions defaults with previous logic
jbaiera Oct 1, 2024
b4f15c0
Relabel TODO's in this PR to better find them
jbaiera Oct 1, 2024
dd4e775
Migrate uses of dataStreamNames to new model and ensure remaining use…
jbaiera Oct 2, 2024
4ff3337
Do not allow selectors on Delete Index Request
jbaiera Oct 8, 2024
6127206
Add support for :: into security expression resolvers
jbaiera Oct 8, 2024
a366dce
Merge branch 'main' into failure-store-naming-scheme
jbaiera Oct 8, 2024
9c786d5
Merge with main
gmarouli Oct 11, 2024
8161653
Merge with main and "Add ResolvedExpression wrapper" #114592
gmarouli Oct 15, 2024
257e3a9
Merge branch 'main' into failure-store-naming-scheme
jbaiera Dec 9, 2024
b9bcd67
Some updates to expression resolution code post update
jbaiera Dec 10, 2024
ab014e8
Merge branch 'main' into failure-store-naming-scheme
jbaiera Dec 10, 2024
8771175
Compilation fixes
jbaiera Dec 10, 2024
75d092f
Refactorings to account for ALL_APPLICABLE cases and other slimming c…
jbaiera Dec 12, 2024
8ea97a4
Test Cleanup
jbaiera Dec 12, 2024
13b127c
Further ALL_APPLICABLE cleanup
jbaiera Dec 12, 2024
e473287
Cleanup combine selector methods
jbaiera Dec 12, 2024
49fa8da
Cleanup combine selector methods
jbaiera Dec 12, 2024
36a7ec2
Refine error message returned when no selectors are provided.
jbaiera Dec 12, 2024
13989b2
Cleanup
jbaiera Dec 12, 2024
cc6c9c4
Update tests and fix a quick bug
jbaiera Dec 12, 2024
4fdf753
Validate rollover request selectors
jbaiera Dec 12, 2024
c4ec4b3
Reintegrate selectors into rollover
jbaiera Dec 12, 2024
201a834
Refactor rollover code
jbaiera Dec 12, 2024
2a9ad90
Fix assertion bug
jbaiera Dec 13, 2024
a8d7d68
Cleanup transport bulk action rollover usage
jbaiera Dec 13, 2024
0d2c7b1
Cleanup TODO
jbaiera Dec 13, 2024
9d9b0cb
Clear out isAllIndices TODO item
jbaiera Dec 13, 2024
f4df38f
Cleanup TODO around remote cluster aware code
jbaiera Dec 13, 2024
226d1be
Note issue with RestoreService - Awaiting fix from mainline
jbaiera Dec 13, 2024
678c653
Clean up uses of strictSingleIndexNoExpandForbidClosed and add single…
jbaiera Dec 13, 2024
daab54a
Merge branch 'main' into failure-store-naming-scheme
jbaiera Dec 13, 2024
2fd1aba
Restrict usage of failure indices in put mappings request
jbaiera Dec 13, 2024
21b8a46
Fix NPE in wildcard resolver
jbaiera Dec 13, 2024
609e933
Fix spotless
jbaiera Dec 13, 2024
f589e7e
Fix ml test
jbaiera Dec 14, 2024
522da35
Fix bug in security error message generation
jbaiera Dec 14, 2024
2a52a03
Merge branch 'main' into failure-store-naming-scheme
jbaiera Dec 14, 2024
e0e3a54
[CI] Auto commit changes from spotless
elasticsearchmachine Dec 14, 2024
82fc167
Disable selectors in Enrich search operations. These follow a special…
jbaiera Dec 15, 2024
1b8e578
fix ml test
jbaiera Dec 16, 2024
b22c9bf
Fix doc test
jbaiera Dec 16, 2024
74ff6d4
Attempt fix rollover yaml tests
jbaiera Dec 16, 2024
77ef9dd
Remove uses of default selectors in favor of using DATA by default. W…
jbaiera Dec 17, 2024
c3d9d5c
Spotless Apply
jbaiera Dec 17, 2024
ed3c054
Spotless Apply
jbaiera Dec 17, 2024
98ac660
Remove selector options/failure store options
jbaiera Dec 17, 2024
5a70369
Some fixups post selector options removal.
jbaiera Dec 17, 2024
ace61f1
Quick all indices optimization in the security code
jbaiera Dec 17, 2024
2dd0200
Fix a whole slew of tests
jbaiera Dec 17, 2024
19efe6c
Tighten up selector usage on some other APIs
jbaiera Dec 17, 2024
f040c94
[CI] Auto commit changes from spotless
elasticsearchmachine Dec 17, 2024
9c2d925
Fix bwc test failures related to failure store rollover
jbaiera Dec 17, 2024
ad48c9c
Fix license header error
jbaiera Dec 17, 2024
92c818e
Remove unneeded assertion
jbaiera Dec 17, 2024
9f529c6
Fix another round of bugs and tests
jbaiera Dec 17, 2024
ed95fa4
[CI] Auto commit changes from spotless
elasticsearchmachine Dec 17, 2024
62755bb
Merge branch 'main' into failure-store-naming-scheme
jbaiera Dec 17, 2024
5d9ab0c
Fix rollover stats acquisition
jbaiera Dec 17, 2024
1183c39
Fix rest IT
jbaiera Dec 17, 2024
c0b8d7e
Fix modify data stream test
jbaiera Dec 17, 2024
ae9f480
Remove old TODO's that are handled, irrelevant now, or will be handle…
jbaiera Dec 17, 2024
23f8665
Fix rollover step tests
jbaiera Dec 17, 2024
299cefc
Update snapshot test
jbaiera Dec 17, 2024
6fe1458
Fix more tests
jbaiera Dec 18, 2024
3a48015
Merge branch 'main' into failure-store-naming-scheme
jbaiera Dec 18, 2024
2e04266
Update server/src/main/java/org/elasticsearch/cluster/metadata/IndexN…
jbaiera Dec 18, 2024
2ac802c
Update server/src/main/java/org/elasticsearch/cluster/metadata/IndexN…
jbaiera Dec 18, 2024
7335f6a
Update server/src/main/java/org/elasticsearch/cluster/metadata/IndexN…
jbaiera Dec 18, 2024
3ef3e8a
Update server/src/main/java/org/elasticsearch/action/admin/indices/ma…
jbaiera Dec 18, 2024
459254f
PR Feedback: Disable selectors on the data stream stats API and retur…
jbaiera Dec 19, 2024
77d2ad7
Merge branch 'main' into failure-store-naming-scheme
jbaiera Dec 19, 2024
8326d0b
PR Feedback: Log better messages for rollovers
jbaiera Dec 19, 2024
57af575
Remove illegal code
jbaiera Dec 19, 2024
0466d94
Update server/src/main/java/org/elasticsearch/action/support/IndicesO…
jbaiera Dec 20, 2024
4faf1ec
Update server/src/main/java/org/elasticsearch/action/support/IndicesO…
jbaiera Dec 20, 2024
52b96cf
PR Feedback: Add some test cases for resolving failure indices in sec…
jbaiera Jan 3, 2025
dea3153
PR Feedback: Fix comment
jbaiera Jan 3, 2025
1499fb2
PR Feedback: Remove another usage of removed indices option
jbaiera Jan 3, 2025
523cbf0
PR Feedback: Update unclear comment
jbaiera Jan 3, 2025
93e8e7e
PR Feedback: Update unclear comment
jbaiera Jan 3, 2025
ba7d839
PR Feedback: Fix bug related to index data stream alias visibility
jbaiera Jan 3, 2025
6b7d584
PR Feedback: Make isAllIndices MORE lazy
jbaiera Jan 3, 2025
2114c82
PR Feedback: Simplify resolveConcreteIndexNames[WithSelector] methods
jbaiera Jan 3, 2025
48e8dae
PR Feedback: Extract helper method
jbaiera Jan 3, 2025
886604b
Merge branch 'main' into failure-store-naming-scheme
jbaiera Jan 3, 2025
3742234
[CI] Auto commit changes from spotless
elasticsearchmachine Jan 3, 2025
c1b680a
PR Feedback: Update TODO with PR number
jbaiera Jan 3, 2025
9104d50
Merge branch 'main' into failure-store-naming-scheme
jbaiera Jan 6, 2025
e255975
Skip invalid bwc tests
jbaiera Jan 6, 2025
05ce329
Merge branch 'main' into failure-store-naming-scheme
jbaiera Jan 6, 2025
5775fe1
Merge branch 'main' into failure-store-naming-scheme
jbaiera Jan 6, 2025
78a765c
Update x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/s…
jbaiera Jan 7, 2025
57fa812
Update x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/s…
jbaiera Jan 7, 2025
6e07e9d
Merge branch 'main' into failure-store-naming-scheme
jbaiera Jan 7, 2025
7575ee3
Merge branch 'main' into failure-store-naming-scheme
jbaiera Jan 7, 2025
5b59dc6
Merge branch 'main' into failure-store-naming-scheme
jbaiera Jan 8, 2025
6e20bbd
Merge branch 'main' into failure-store-naming-scheme
jbaiera Jan 8, 2025
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
1 change: 0 additions & 1 deletion docs/reference/ml/anomaly-detection/apis/put-job.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -557,4 +557,3 @@ The API returns the following results:
// TESTRESPONSE[s/"job_version" : "8.4.0"/"job_version" : $body.job_version/]
// TESTRESPONSE[s/1656087283340/$body.$_path/]
// TESTRESPONSE[s/"superuser"/"_es_test_root"/]
// TESTRESPONSE[s/"ignore_throttled" : true/"ignore_throttled" : true,"failure_store":"exclude"/]
13 changes: 13 additions & 0 deletions modules/data-streams/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ restResources {

dependencies {
testImplementation project(path: ':test:test-clusters')
testImplementation project(":modules:mapper-extras")
internalClusterTestImplementation project(":modules:mapper-extras")
}

Expand Down Expand Up @@ -70,4 +71,16 @@ tasks.named("yamlRestCompatTestTransform").configure({ task ->
task.skipTest("data_stream/200_rollover_failure_store/Lazily roll over a data stream's failure store after a shard failure", "Configuring the failure store via data stream templates is not supported anymore.")
task.skipTest("data_stream/200_rollover_failure_store/Don't roll over a data stream's failure store when conditions aren't met", "Configuring the failure store via data stream templates is not supported anymore.")
task.skipTest("data_stream/200_rollover_failure_store/Roll over a data stream's failure store with conditions", "Configuring the failure store via data stream templates is not supported anymore.")

task.skipTest("data_stream/200_rollover_failure_store/Rolling over a failure store on a data stream without the failure store enabled should work", "Rolling over a data stream using target_failure_store is no longer supported.")
task.skipTest("data_stream/200_rollover_failure_store/Rolling over an uninitialized failure store should initialize it", "Rolling over a data stream using target_failure_store is no longer supported.")

task.skipTest("data_stream/210_rollover_failure_store/A failure store marked for lazy rollover should only be rolled over when there is a failure", "Rolling over a data stream using target_failure_store is no longer supported.")
task.skipTest("data_stream/210_rollover_failure_store/Don't roll over a data stream's failure store when conditions aren't met", "Rolling over a data stream using target_failure_store is no longer supported.")
task.skipTest("data_stream/210_rollover_failure_store/Rolling over a failure store on a data stream without the failure store enabled should work", "Rolling over a data stream using target_failure_store is no longer supported.")
task.skipTest("data_stream/210_rollover_failure_store/Rolling over an uninitialized failure store should initialize it", "Rolling over a data stream using target_failure_store is no longer supported.")
task.skipTest("data_stream/210_rollover_failure_store/Roll over a data stream's failure store with conditions", "Rolling over a data stream using target_failure_store is no longer supported.")
task.skipTest("data_stream/210_rollover_failure_store/Lazily roll over a data stream's failure store after an ingest failure", "Rolling over a data stream using target_failure_store is no longer supported.")
task.skipTest("data_stream/210_rollover_failure_store/Lazily roll over a data stream's failure store after a shard failure", "Rolling over a data stream using target_failure_store is no longer supported.")
task.skipTest("data_stream/210_rollover_failure_store/Roll over a data stream's failure store without conditions", "Rolling over a data stream using target_failure_store is no longer supported.")
})
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
import org.elasticsearch.action.datastreams.CreateDataStreamAction;
import org.elasticsearch.action.datastreams.DeleteDataStreamAction;
import org.elasticsearch.action.datastreams.GetDataStreamAction;
import org.elasticsearch.action.support.IndexComponentSelector;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.client.internal.Client;
import org.elasticsearch.cluster.metadata.DataStream;
import org.elasticsearch.cluster.metadata.DataStreamAlias;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.unit.ByteSizeUnit;
import org.elasticsearch.index.Index;
Expand Down Expand Up @@ -136,10 +138,7 @@ public void setup() throws Exception {
assertTrue(response.isAcknowledged());

// Initialize the failure store.
RolloverRequest rolloverRequest = new RolloverRequest("with-fs", null);
rolloverRequest.setIndicesOptions(
IndicesOptions.builder(rolloverRequest.indicesOptions()).selectorOptions(IndicesOptions.SelectorOptions.FAILURES).build()
);
RolloverRequest rolloverRequest = new RolloverRequest("with-fs::failures", null);
response = client.execute(RolloverAction.INSTANCE, rolloverRequest).get();
assertTrue(response.isAcknowledged());

Expand Down Expand Up @@ -345,7 +344,7 @@ public void testFailureStoreSnapshotAndRestore() throws Exception {
.cluster()
.prepareCreateSnapshot(TEST_REQUEST_TIMEOUT, REPO, SNAPSHOT)
.setWaitForCompletion(true)
.setIndices(dataStreamName)
.setIndices(IndexNameExpressionResolver.combineSelector(dataStreamName, IndexComponentSelector.ALL_APPLICABLE))
.setIncludeGlobalState(false)
.get();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
import org.elasticsearch.action.bulk.FailureStoreMetrics;
import org.elasticsearch.action.datastreams.CreateDataStreamAction;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.support.IndicesOptions;
import org.elasticsearch.action.support.IndexComponentSelector;
import org.elasticsearch.action.support.WriteRequest;
import org.elasticsearch.cluster.metadata.ComposableIndexTemplate;
import org.elasticsearch.cluster.metadata.DataStreamTestHelper;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Template;
import org.elasticsearch.common.compress.CompressedXContent;
import org.elasticsearch.core.Strings;
Expand Down Expand Up @@ -194,9 +195,9 @@ public void testRejectionFromFailureStore() throws IOException {
createDataStream();

// Initialize failure store.
var rolloverRequest = new RolloverRequest(dataStream, null);
rolloverRequest.setIndicesOptions(
IndicesOptions.builder(rolloverRequest.indicesOptions()).selectorOptions(IndicesOptions.SelectorOptions.FAILURES).build()
var rolloverRequest = new RolloverRequest(
IndexNameExpressionResolver.combineSelector(dataStream, IndexComponentSelector.FAILURES),
null
);
var rolloverResponse = client().execute(RolloverAction.INSTANCE, rolloverRequest).actionGet();
var failureStoreIndex = rolloverResponse.getNewIndex();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void setup() throws IOException {

assertOK(client().performRequest(new Request("PUT", "/_data_stream/" + DATA_STREAM_NAME)));
// Initialize the failure store.
assertOK(client().performRequest(new Request("POST", DATA_STREAM_NAME + "/_rollover?target_failure_store")));
assertOK(client().performRequest(new Request("POST", DATA_STREAM_NAME + "::failures/_rollover")));
ensureGreen(DATA_STREAM_NAME);

final Response dataStreamResponse = client().performRequest(new Request("GET", "/_data_stream/" + DATA_STREAM_NAME));
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.elasticsearch.action.datastreams.DataStreamsStatsAction;
import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.action.support.DefaultShardOperationFailedException;
import org.elasticsearch.action.support.IndexComponentSelector;
import org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.block.ClusterBlockException;
Expand Down Expand Up @@ -102,10 +103,11 @@ protected ClusterBlockException checkRequestBlock(

@Override
protected String[] resolveConcreteIndexNames(ClusterState clusterState, DataStreamsStatsAction.Request request) {
return DataStreamsActionUtil.resolveConcreteIndexNames(
return DataStreamsActionUtil.resolveConcreteIndexNamesWithSelector(
indexNameExpressionResolver,
clusterState,
request.indices(),
IndexComponentSelector.ALL_APPLICABLE,
request.indicesOptions()
).toArray(String[]::new);
}
Expand Down Expand Up @@ -163,13 +165,17 @@ protected DataStreamsStatsAction.DataStreamShardStats readShardResult(StreamInpu
request.indicesOptions(),
request.indices()
);
for (String abstractionName : abstractionNames) {
IndexAbstraction indexAbstraction = indicesLookup.get(abstractionName);
for (String abstraction : abstractionNames) {
IndexAbstraction indexAbstraction = indicesLookup.get(abstraction);
assert indexAbstraction != null;
if (indexAbstraction.getType() == IndexAbstraction.Type.DATA_STREAM) {
DataStream dataStream = (DataStream) indexAbstraction;
AggregatedStats stats = aggregatedDataStreamsStats.computeIfAbsent(dataStream.getName(), s -> new AggregatedStats());
dataStream.getIndices().stream().map(Index::getName).forEach(index -> {
dataStream.getBackingIndices().getIndices().stream().map(Index::getName).forEach(index -> {
stats.backingIndices.add(index);
allBackingIndices.add(index);
});
dataStream.getFailureIndices().getIndices().stream().map(Index::getName).forEach(index -> {
stats.backingIndices.add(index);
allBackingIndices.add(index);
});
Expand Down
Loading