Remove trappy timeouts from GetIndexRequest (#120037)

Relates #107984
This commit is contained in:
Niels Bauman 2025-01-16 16:05:36 +10:00 committed by GitHub
parent c0f54a94be
commit 9f597a4eb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
65 changed files with 240 additions and 143 deletions

View file

@ -182,7 +182,8 @@ public class DataStreamIT extends ESIntegTestCase {
String backingIndex = barDataStream.getIndices().get(0).getName();
backingIndices.add(backingIndex);
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet();
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex))
.actionGet();
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue());
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true));
Map<?, ?> mappings = getIndexResponse.getMappings().get(backingIndex).getSourceAsMap();
@ -190,7 +191,7 @@ public class DataStreamIT extends ESIntegTestCase {
backingIndex = fooDataStream.getIndices().get(0).getName();
backingIndices.add(backingIndex);
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet();
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex)).actionGet();
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue());
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true));
mappings = getIndexResponse.getMappings().get(backingIndex).getSourceAsMap();
@ -214,7 +215,7 @@ public class DataStreamIT extends ESIntegTestCase {
backingIndex = fooRolloverResponse.getNewIndex();
backingIndices.add(backingIndex);
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet();
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex)).actionGet();
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue());
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true));
mappings = getIndexResponse.getMappings().get(backingIndex).getSourceAsMap();
@ -222,7 +223,7 @@ public class DataStreamIT extends ESIntegTestCase {
backingIndex = barRolloverResponse.getNewIndex();
backingIndices.add(backingIndex);
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet();
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex)).actionGet();
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue());
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true));
mappings = getIndexResponse.getMappings().get(backingIndex).getSourceAsMap();
@ -245,7 +246,7 @@ public class DataStreamIT extends ESIntegTestCase {
expectThrows(
IndexNotFoundException.class,
"Backing index '" + index + "' should have been deleted.",
() -> indicesAdmin().getIndex(new GetIndexRequest().indices(index)).actionGet()
() -> indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(index)).actionGet()
);
}
}
@ -479,7 +480,8 @@ public class DataStreamIT extends ESIntegTestCase {
String backingIndex = getDataStreamResponse.getDataStreams().get(0).getDataStream().getIndices().get(0).getName();
assertThat(backingIndex, backingIndexEqualTo(dataStreamName, 1));
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(dataStreamName)).actionGet();
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(dataStreamName))
.actionGet();
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue());
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true));
assertThat(
@ -492,7 +494,7 @@ public class DataStreamIT extends ESIntegTestCase {
assertThat(backingIndex, backingIndexEqualTo(dataStreamName, 2));
assertTrue(rolloverResponse.isRolledOver());
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet();
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex)).actionGet();
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue());
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true));
assertThat(
@ -518,7 +520,7 @@ public class DataStreamIT extends ESIntegTestCase {
expectThrows(
IndexNotFoundException.class,
"Backing index '" + index.getName() + "' should have been deleted.",
() -> indicesAdmin().getIndex(new GetIndexRequest().indices(index.getName())).actionGet()
() -> indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(index.getName())).actionGet()
);
}
}
@ -606,7 +608,7 @@ public class DataStreamIT extends ESIntegTestCase {
verifyResolvability(dataStreamName, clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT, dataStreamName), false);
verifyResolvability(dataStreamName, clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).setIndices(dataStreamName), false);
verifyResolvability(dataStreamName, client().prepareFieldCaps(dataStreamName).setFields("*"), false);
verifyResolvability(dataStreamName, indicesAdmin().prepareGetIndex().addIndices(dataStreamName), false);
verifyResolvability(dataStreamName, indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(dataStreamName), false);
verifyResolvability(dataStreamName, indicesAdmin().prepareOpen(dataStreamName), false);
verifyResolvability(dataStreamName, indicesAdmin().prepareClose(dataStreamName), true);
verifyResolvability(aliasToDataStream, indicesAdmin().prepareClose(aliasToDataStream), true);
@ -653,7 +655,7 @@ public class DataStreamIT extends ESIntegTestCase {
verifyResolvability(wildcardExpression, clusterAdmin().prepareHealth(TEST_REQUEST_TIMEOUT, wildcardExpression), false);
verifyResolvability(wildcardExpression, clusterAdmin().prepareState(TEST_REQUEST_TIMEOUT).setIndices(wildcardExpression), false);
verifyResolvability(wildcardExpression, client().prepareFieldCaps(wildcardExpression).setFields("*"), false);
verifyResolvability(wildcardExpression, indicesAdmin().prepareGetIndex().addIndices(wildcardExpression), false);
verifyResolvability(wildcardExpression, indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(wildcardExpression), false);
verifyResolvability(wildcardExpression, indicesAdmin().prepareOpen(wildcardExpression), false);
verifyResolvability(wildcardExpression, indicesAdmin().prepareClose(wildcardExpression), false);
verifyResolvability(
@ -1401,7 +1403,8 @@ public class DataStreamIT extends ESIntegTestCase {
}
private static void assertBackingIndex(String backingIndex, String timestampFieldPathInMapping, Map<?, ?> expectedMapping) {
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet();
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex))
.actionGet();
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue());
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true));
Map<?, ?> mappings = getIndexResponse.getMappings().get(backingIndex).getSourceAsMap();
@ -1488,7 +1491,8 @@ public class DataStreamIT extends ESIntegTestCase {
assertThat(getDataStreamsResponse.getDataStreams().get(2).getDataStream().getName(), equalTo("logs-foobaz2"));
assertThat(getDataStreamsResponse.getDataStreams().get(3).getDataStream().getName(), equalTo("logs-foobaz3"));
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices("logs-bar*")).actionGet();
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices("logs-bar*"))
.actionGet();
assertThat(getIndexResponse.getIndices(), arrayWithSize(4));
assertThat(getIndexResponse.getIndices(), hasItemInArray("logs-barbaz"));
assertThat(getIndexResponse.getIndices(), hasItemInArray("logs-barfoo"));
@ -1521,7 +1525,8 @@ public class DataStreamIT extends ESIntegTestCase {
.actionGet();
assertThat(getDataStreamsResponse.getDataStreams(), hasSize(0));
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices("logs-foobar")).actionGet();
GetIndexResponse getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices("logs-foobar"))
.actionGet();
assertThat(getIndexResponse.getIndices(), arrayWithSize(1));
assertThat(getIndexResponse.getIndices(), hasItemInArray("logs-foobar"));
assertThat(getIndexResponse.getSettings().get("logs-foobar").get(IndexMetadata.SETTING_NUMBER_OF_REPLICAS), equalTo("0"));
@ -1657,7 +1662,7 @@ public class DataStreamIT extends ESIntegTestCase {
.actionGet();
String newBackingIndexName = getDataStreamResponse.getDataStreams().get(0).getDataStream().getWriteIndex().getName();
assertThat(newBackingIndexName, backingIndexEqualTo("potato-biscuit", 2));
indicesAdmin().prepareGetIndex().addIndices(newBackingIndexName).get();
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(newBackingIndexName).get();
} catch (Exception e) {
logger.info("--> expecting second index to be created but it has not yet been created");
fail("expecting second index to exist");

View file

@ -1304,7 +1304,7 @@ public class DataStreamsSnapshotsIT extends AbstractSnapshotIntegTestCase {
assertEquals(RestStatus.OK, restoreSnapshotResponse.status());
assertThat(getDataStreamInfo("*"), hasSize(3));
assertNotNull(client.admin().indices().prepareGetIndex().setIndices(indexName).get());
assertNotNull(client.admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices(indexName).get());
}
public void testRestoreDataStreamAliasWithConflictingDataStream() throws Exception {

View file

@ -50,7 +50,7 @@ public class DataTierDataStreamIT extends ESIntegTestCase {
.setWaitForActiveShards(0)
.get()
.getIndex();
var idxSettings = indicesAdmin().prepareGetIndex().addIndices(index).get().getSettings().get(dsIndexName);
var idxSettings = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(index).get().getSettings().get(dsIndexName);
assertThat(DataTier.TIER_PREFERENCE_SETTING.get(idxSettings), equalTo(DataTier.DATA_HOT));
logger.info("--> waiting for {} to be yellow", index);
@ -62,7 +62,7 @@ public class DataTierDataStreamIT extends ESIntegTestCase {
// new index name should have the rolled over name
assertNotEquals(dsIndexName, rolledOverIndexName);
idxSettings = indicesAdmin().prepareGetIndex().addIndices(index).get().getSettings().get(rolledOverIndexName);
idxSettings = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(index).get().getSettings().get(rolledOverIndexName);
assertThat(DataTier.TIER_PREFERENCE_SETTING.get(idxSettings), equalTo(DataTier.DATA_HOT));
}

View file

@ -341,7 +341,10 @@ public class ResolveClusterDataStreamIT extends AbstractMultiClustersTestCase {
DataStream fooDataStream = getDataStreamResponse.getDataStreams().get(0).getDataStream();
String backingIndex = fooDataStream.getIndices().get(0).getName();
backingIndices.add(backingIndex);
GetIndexResponse getIndexResponse = client.admin().indices().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet();
GetIndexResponse getIndexResponse = client.admin()
.indices()
.getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex))
.actionGet();
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue());
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true));
Map<?, ?> mappings = getIndexResponse.getMappings().get(backingIndex).getSourceAsMap();
@ -377,7 +380,10 @@ public class ResolveClusterDataStreamIT extends AbstractMultiClustersTestCase {
DataStream barDataStream = getDataStreamResponse.getDataStreams().get(0).getDataStream();
String backingIndex = barDataStream.getIndices().get(0).getName();
backingIndices.add(backingIndex);
GetIndexResponse getIndexResponse = client.admin().indices().getIndex(new GetIndexRequest().indices(backingIndex)).actionGet();
GetIndexResponse getIndexResponse = client.admin()
.indices()
.getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndex))
.actionGet();
assertThat(getIndexResponse.getSettings().get(backingIndex), notNullValue());
assertThat(getIndexResponse.getSettings().get(backingIndex).getAsBoolean("index.hidden", null), is(true));
Map<?, ?> mappings = getIndexResponse.getMappings().get(backingIndex).getSourceAsMap();

View file

@ -104,7 +104,7 @@ public class SystemDataStreamSnapshotIT extends AbstractSnapshotIntegTestCase {
}
{
GetIndexResponse indicesRemaining = indicesAdmin().prepareGetIndex().addIndices("_all").get();
GetIndexResponse indicesRemaining = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("_all").get();
assertThat(indicesRemaining.indices(), arrayWithSize(0));
assertSystemDataStreamDoesNotExist();
}
@ -236,7 +236,7 @@ public class SystemDataStreamSnapshotIT extends AbstractSnapshotIntegTestCase {
assertAcked(indicesAdmin().prepareDelete("my-index"));
{
GetIndexResponse indicesRemaining = indicesAdmin().prepareGetIndex().addIndices("_all").get();
GetIndexResponse indicesRemaining = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("_all").get();
assertThat(indicesRemaining.indices(), arrayWithSize(0));
}

View file

@ -155,7 +155,7 @@ public class TSDBIndexingIT extends ESSingleNodeTestCase {
}
// fetch end time
var getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndexName)).actionGet();
var getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndexName)).actionGet();
Instant endTime = IndexSettings.TIME_SERIES_END_TIME.get(getIndexResponse.getSettings().get(backingIndexName));
// index another doc and verify index
@ -194,7 +194,7 @@ public class TSDBIndexingIT extends ESSingleNodeTestCase {
var newBackingIndexName = rolloverResponse.getNewIndex();
// index and check target index is new
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest().indices(newBackingIndexName)).actionGet();
getIndexResponse = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(newBackingIndexName)).actionGet();
Instant newStartTime = IndexSettings.TIME_SERIES_START_TIME.get(getIndexResponse.getSettings().get(newBackingIndexName));
Instant newEndTime = IndexSettings.TIME_SERIES_END_TIME.get(getIndexResponse.getSettings().get(newBackingIndexName));

View file

@ -183,7 +183,7 @@ public class TSDBPassthroughIndexingIT extends ESSingleNodeTestCase {
}
// validate index:
var getIndexResponse = client().admin().indices().getIndex(new GetIndexRequest().indices(index)).actionGet();
var getIndexResponse = client().admin().indices().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(index)).actionGet();
assertThat(getIndexResponse.getSettings().get(index).get("index.routing_path"), equalTo("[attributes.*]"));
// validate mapping
var mapping = getIndexResponse.mappings().get(index).getSourceAsMap();

View file

@ -71,7 +71,7 @@ public class AutoCreateSystemIndexIT extends ESIntegTestCase {
CreateIndexRequest request = new CreateIndexRequest(PRIMARY_INDEX_NAME);
client().execute(AutoCreateAction.INSTANCE, request).get();
GetIndexResponse response = indicesAdmin().prepareGetIndex().addIndices(PRIMARY_INDEX_NAME).get();
GetIndexResponse response = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(PRIMARY_INDEX_NAME).get();
assertThat(response.indices().length, is(1));
assertThat(response.aliases().size(), is(1));
assertThat(response.aliases().get(PRIMARY_INDEX_NAME).size(), is(1));
@ -85,7 +85,7 @@ public class AutoCreateSystemIndexIT extends ESIntegTestCase {
CreateIndexRequest request = new CreateIndexRequest(INDEX_NAME);
client().execute(AutoCreateAction.INSTANCE, request).get();
GetIndexResponse response = indicesAdmin().prepareGetIndex().addIndices(PRIMARY_INDEX_NAME).get();
GetIndexResponse response = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(PRIMARY_INDEX_NAME).get();
assertThat(response.indices().length, is(1));
assertThat(response.aliases().size(), is(1));
assertThat(response.aliases().get(PRIMARY_INDEX_NAME).size(), is(1));
@ -99,7 +99,7 @@ public class AutoCreateSystemIndexIT extends ESIntegTestCase {
CreateIndexRequest request = new CreateIndexRequest(INDEX_NAME + "-2");
client().execute(AutoCreateAction.INSTANCE, request).get();
GetIndexResponse response = indicesAdmin().prepareGetIndex().addIndices(INDEX_NAME + "-2").get();
GetIndexResponse response = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(INDEX_NAME + "-2").get();
assertThat(response.indices().length, is(1));
assertThat(response.aliases().size(), is(1));
assertThat(response.aliases().get(INDEX_NAME + "-2").size(), is(1));
@ -144,7 +144,9 @@ public class AutoCreateSystemIndexIT extends ESIntegTestCase {
CreateIndexRequest request = new CreateIndexRequest(UnmanagedSystemIndexTestPlugin.SYSTEM_INDEX_NAME);
client().execute(AutoCreateAction.INSTANCE, request).get();
GetIndexResponse response = indicesAdmin().prepareGetIndex().addIndices(UnmanagedSystemIndexTestPlugin.SYSTEM_INDEX_NAME).get();
GetIndexResponse response = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.addIndices(UnmanagedSystemIndexTestPlugin.SYSTEM_INDEX_NAME)
.get();
assertThat(response.indices().length, is(1));
Settings settings = response.settings().get(UnmanagedSystemIndexTestPlugin.SYSTEM_INDEX_NAME);
assertThat(settings, notNullValue());

View file

@ -46,7 +46,7 @@ public class GetIndexIT extends ESIntegTestCase {
}
public void testSimple() {
GetIndexResponse response = indicesAdmin().prepareGetIndex().addIndices("idx").get();
GetIndexResponse response = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("idx").get();
String[] indices = response.indices();
assertThat(indices, notNullValue());
assertThat(indices.length, equalTo(1));
@ -58,7 +58,7 @@ public class GetIndexIT extends ESIntegTestCase {
public void testSimpleUnknownIndex() {
try {
indicesAdmin().prepareGetIndex().addIndices("missing_idx").get();
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("missing_idx").get();
fail("Expected IndexNotFoundException");
} catch (IndexNotFoundException e) {
assertThat(e.getMessage(), is("no such index [missing_idx]"));
@ -66,7 +66,7 @@ public class GetIndexIT extends ESIntegTestCase {
}
public void testUnknownIndexWithAllowNoIndices() {
GetIndexResponse response = indicesAdmin().prepareGetIndex()
GetIndexResponse response = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.addIndices("missing_idx")
.setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN)
.get();
@ -77,7 +77,7 @@ public class GetIndexIT extends ESIntegTestCase {
}
public void testEmpty() {
GetIndexResponse response = indicesAdmin().prepareGetIndex().addIndices("empty_idx").get();
GetIndexResponse response = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("empty_idx").get();
String[] indices = response.indices();
assertThat(indices, notNullValue());
assertThat(indices.length, equalTo(1));
@ -88,7 +88,10 @@ public class GetIndexIT extends ESIntegTestCase {
}
public void testSimpleMapping() {
GetIndexResponse response = runWithRandomFeatureMethod(indicesAdmin().prepareGetIndex().addIndices("idx"), Feature.MAPPINGS);
GetIndexResponse response = runWithRandomFeatureMethod(
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("idx"),
Feature.MAPPINGS
);
String[] indices = response.indices();
assertThat(indices, notNullValue());
assertThat(indices.length, equalTo(1));
@ -99,7 +102,10 @@ public class GetIndexIT extends ESIntegTestCase {
}
public void testSimpleAlias() {
GetIndexResponse response = runWithRandomFeatureMethod(indicesAdmin().prepareGetIndex().addIndices("idx"), Feature.ALIASES);
GetIndexResponse response = runWithRandomFeatureMethod(
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("idx"),
Feature.ALIASES
);
String[] indices = response.indices();
assertThat(indices, notNullValue());
assertThat(indices.length, equalTo(1));
@ -110,7 +116,10 @@ public class GetIndexIT extends ESIntegTestCase {
}
public void testSimpleSettings() {
GetIndexResponse response = runWithRandomFeatureMethod(indicesAdmin().prepareGetIndex().addIndices("idx"), Feature.SETTINGS);
GetIndexResponse response = runWithRandomFeatureMethod(
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("idx"),
Feature.SETTINGS
);
String[] indices = response.indices();
assertThat(indices, notNullValue());
assertThat(indices.length, equalTo(1));
@ -127,7 +136,7 @@ public class GetIndexIT extends ESIntegTestCase {
features.add(randomFrom(Feature.values()));
}
GetIndexResponse response = runWithRandomFeatureMethod(
indicesAdmin().prepareGetIndex().addIndices("idx"),
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("idx"),
features.toArray(new Feature[features.size()])
);
String[] indices = response.indices();
@ -158,7 +167,7 @@ public class GetIndexIT extends ESIntegTestCase {
features.add(randomFrom(Feature.values()));
}
GetIndexResponse response = runWithRandomFeatureMethod(
indicesAdmin().prepareGetIndex().addIndices("empty_idx"),
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("empty_idx"),
features.toArray(new Feature[features.size()])
);
String[] indices = response.indices();
@ -182,7 +191,7 @@ public class GetIndexIT extends ESIntegTestCase {
for (String block : Arrays.asList(SETTING_BLOCKS_READ, SETTING_BLOCKS_WRITE, SETTING_READ_ONLY, SETTING_READ_ONLY_ALLOW_DELETE)) {
try {
enableIndexBlock("idx", block);
GetIndexResponse response = indicesAdmin().prepareGetIndex()
GetIndexResponse response = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.addIndices("idx")
.addFeatures(Feature.MAPPINGS, Feature.ALIASES)
.get();
@ -200,7 +209,7 @@ public class GetIndexIT extends ESIntegTestCase {
try {
enableIndexBlock("idx", SETTING_BLOCKS_METADATA);
assertBlocked(
indicesAdmin().prepareGetIndex().addIndices("idx").addFeatures(Feature.MAPPINGS, Feature.ALIASES),
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("idx").addFeatures(Feature.MAPPINGS, Feature.ALIASES),
INDEX_METADATA_BLOCK
);
} finally {

View file

@ -805,7 +805,7 @@ public class RolloverIT extends ESIntegTestCase {
assertBusy(() -> {
try {
indicesAdmin().prepareGetIndex().addIndices(writeIndexPrefix + "000002").get();
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(writeIndexPrefix + "000002").get();
} catch (Exception e) {
logger.info("--> expecting second index to be created but it has not yet been created");
fail("expecting second index to exist");
@ -824,7 +824,7 @@ public class RolloverIT extends ESIntegTestCase {
});
// We should *NOT* have a third index, it should have rolled over *exactly* once
expectThrows(Exception.class, indicesAdmin().prepareGetIndex().addIndices(writeIndexPrefix + "000003"));
expectThrows(Exception.class, indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(writeIndexPrefix + "000003"));
}
public void testRolloverConcurrently() throws Exception {

View file

@ -54,7 +54,7 @@ public class PeerRecoveryRetentionLeaseCreationIT extends ESIntegTestCase {
ensureGreen(INDEX_NAME);
IndicesService service = internalCluster().getInstance(IndicesService.class, dataNode);
String uuid = indicesAdmin().getIndex(new GetIndexRequest().indices(INDEX_NAME))
String uuid = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(INDEX_NAME))
.actionGet()
.getSetting(INDEX_NAME, IndexMetadata.SETTING_INDEX_UUID);
Path path = service.indexService(new Index(INDEX_NAME, uuid)).getShard(0).shardPath().getShardStatePath();

View file

@ -87,16 +87,25 @@ public class FeatureStateResetApiIT extends ESIntegTestCase {
);
// verify that both indices are gone
Exception e1 = expectThrows(IndexNotFoundException.class, indicesAdmin().prepareGetIndex().addIndices(systemIndex1));
Exception e1 = expectThrows(
IndexNotFoundException.class,
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(systemIndex1)
);
assertThat(e1.getMessage(), containsString("no such index"));
Exception e2 = expectThrows(IndexNotFoundException.class, indicesAdmin().prepareGetIndex().addIndices(associatedIndex));
Exception e2 = expectThrows(
IndexNotFoundException.class,
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(associatedIndex)
);
assertThat(e2.getMessage(), containsString("no such index"));
Exception e3 = expectThrows(IndexNotFoundException.class, indicesAdmin().prepareGetIndex().addIndices(systemIndex2));
Exception e3 = expectThrows(
IndexNotFoundException.class,
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(systemIndex2)
);
assertThat(e3.getMessage(), containsString("no such index"));
GetIndexResponse response = indicesAdmin().prepareGetIndex().addIndices("my_index").get();
GetIndexResponse response = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("my_index").get();
assertThat(response.getIndices(), arrayContaining("my_index"));
}

View file

@ -15,6 +15,7 @@ import org.elasticsearch.action.support.master.info.ClusterInfoRequest;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.util.ArrayUtils;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.tasks.CancellableTask;
import org.elasticsearch.tasks.Task;
@ -93,8 +94,8 @@ public class GetIndexRequest extends ClusterInfoRequest<GetIndexRequest> {
private boolean humanReadable = false;
private transient boolean includeDefaults = false;
public GetIndexRequest() {
super(IndicesOptions.strictExpandOpen());
public GetIndexRequest(TimeValue masterTimeout) {
super(masterTimeout, IndicesOptions.strictExpandOpen());
}
public GetIndexRequest(StreamInput in) throws IOException {

View file

@ -12,11 +12,12 @@ package org.elasticsearch.action.admin.indices.get;
import org.elasticsearch.action.admin.indices.get.GetIndexRequest.Feature;
import org.elasticsearch.action.support.master.info.ClusterInfoRequestBuilder;
import org.elasticsearch.client.internal.ElasticsearchClient;
import org.elasticsearch.core.TimeValue;
public class GetIndexRequestBuilder extends ClusterInfoRequestBuilder<GetIndexRequest, GetIndexResponse, GetIndexRequestBuilder> {
public GetIndexRequestBuilder(ElasticsearchClient client, String... indices) {
super(client, GetIndexAction.INSTANCE, new GetIndexRequest().indices(indices));
public GetIndexRequestBuilder(ElasticsearchClient client, TimeValue masterTimeout, String... indices) {
super(client, GetIndexAction.INSTANCE, new GetIndexRequest(masterTimeout).indices(indices));
}
public GetIndexRequestBuilder setFeatures(Feature... features) {

View file

@ -349,8 +349,8 @@ public class IndicesAdminClient implements ElasticsearchClient {
execute(GetIndexAction.INSTANCE, request, listener);
}
public GetIndexRequestBuilder prepareGetIndex() {
return new GetIndexRequestBuilder(this);
public GetIndexRequestBuilder prepareGetIndex(TimeValue masterTimeout) {
return new GetIndexRequestBuilder(this, masterTimeout);
}
public ActionFuture<BroadcastResponse> clearCache(final ClearIndicesCacheRequest request) {

View file

@ -48,11 +48,10 @@ public class RestGetIndicesAction extends BaseRestHandler {
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
final GetIndexRequest getIndexRequest = new GetIndexRequest();
final GetIndexRequest getIndexRequest = new GetIndexRequest(getMasterNodeTimeout(request));
getIndexRequest.indices(indices);
getIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, getIndexRequest.indicesOptions()));
getIndexRequest.local(request.paramAsBoolean("local", getIndexRequest.local()));
getIndexRequest.masterNodeTimeout(getMasterNodeTimeout(request));
getIndexRequest.humanReadable(request.paramAsBoolean("human", false));
getIndexRequest.includeDefaults(request.paramAsBoolean("include_defaults", false));
getIndexRequest.features(GetIndexRequest.Feature.fromRequest(request));

View file

@ -80,7 +80,7 @@ public class GetIndexActionTests extends ESSingleNodeTestCase {
}
public void testIncludeDefaults() {
GetIndexRequest defaultsRequest = new GetIndexRequest().indices(indexName).includeDefaults(true);
GetIndexRequest defaultsRequest = new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(indexName).includeDefaults(true);
ActionTestUtils.execute(
getIndexAction,
null,
@ -95,7 +95,7 @@ public class GetIndexActionTests extends ESSingleNodeTestCase {
}
public void testDoNotIncludeDefaults() {
GetIndexRequest noDefaultsRequest = new GetIndexRequest().indices(indexName);
GetIndexRequest noDefaultsRequest = new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(indexName);
ActionTestUtils.execute(
getIndexAction,
null,

View file

@ -75,7 +75,7 @@ public class GetIndexRequestTests extends ESTestCase {
}
public void testIndicesOptions() {
GetIndexRequest getIndexRequest = new GetIndexRequest();
GetIndexRequest getIndexRequest = new GetIndexRequest(TEST_REQUEST_TIMEOUT);
assertThat(
getIndexRequest.indicesOptions().concreteTargetOptions(),
equalTo(IndicesOptions.strictExpandOpen().concreteTargetOptions())

View file

@ -59,7 +59,9 @@ public class FieldFilterMapperPluginTests extends ESSingleNodeTestCase {
}
public void testGetIndex() {
GetIndexResponse getIndexResponse = indicesAdmin().prepareGetIndex().setFeatures(GetIndexRequest.Feature.MAPPINGS).get();
GetIndexResponse getIndexResponse = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.setFeatures(GetIndexRequest.Feature.MAPPINGS)
.get();
assertExpectedMappings(getIndexResponse.mappings());
}

View file

@ -1215,7 +1215,7 @@ public class SearchServiceSingleNodeTests extends ESSingleNodeTestCase {
// ok
}
expectThrows(IndexNotFoundException.class, () -> indicesAdmin().prepareGetIndex().setIndices("index").get());
expectThrows(IndexNotFoundException.class, () -> indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices("index").get());
assertEquals(0, service.getActiveContexts());

View file

@ -1613,7 +1613,7 @@ public abstract class ESIntegTestCase extends ESTestCase {
public static boolean indexExists(String index, Client client) {
GetIndexResponse getIndexResponse = client.admin()
.indices()
.prepareGetIndex()
.prepareGetIndex(TEST_REQUEST_TIMEOUT)
.setIndices(index)
.setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_CLOSED)
.get();
@ -2564,14 +2564,14 @@ public abstract class ESIntegTestCase extends ESTestCase {
}
public static Index resolveIndex(String index) {
GetIndexResponse getIndexResponse = indicesAdmin().prepareGetIndex().setIndices(index).get();
GetIndexResponse getIndexResponse = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices(index).get();
assertTrue("index " + index + " not found", getIndexResponse.getSettings().containsKey(index));
String uuid = getIndexResponse.getSettings().get(index).get(IndexMetadata.SETTING_INDEX_UUID);
return new Index(index, uuid);
}
public static String resolveCustomDataPath(String index) {
GetIndexResponse getIndexResponse = indicesAdmin().prepareGetIndex().setIndices(index).get();
GetIndexResponse getIndexResponse = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices(index).get();
assertTrue("index " + index + " not found", getIndexResponse.getSettings().containsKey(index));
return getIndexResponse.getSettings().get(index).get(IndexMetadata.SETTING_DATA_PATH);
}

View file

@ -171,7 +171,7 @@ public abstract class ESSingleNodeTestCase extends ESTestCase {
metadata.transientSettings().size(),
equalTo(0)
);
GetIndexResponse indices = indicesAdmin().prepareGetIndex()
GetIndexResponse indices = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_CLOSED_HIDDEN)
.addIndices("*")
.get();
@ -401,7 +401,7 @@ public abstract class ESSingleNodeTestCase extends ESTestCase {
}
public Index resolveIndex(String index) {
GetIndexResponse getIndexResponse = indicesAdmin().prepareGetIndex().setIndices(index).get();
GetIndexResponse getIndexResponse = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices(index).get();
assertTrue("index " + index + " not found", getIndexResponse.getSettings().containsKey(index));
String uuid = getIndexResponse.getSettings().get(index).get(IndexMetadata.SETTING_INDEX_UUID);
return new Index(index, uuid);

View file

@ -150,7 +150,7 @@ public class FrozenExistenceDeciderIT extends AbstractFrozenAutoscalingIntegTest
}
private String[] indices() {
return indicesAdmin().prepareGetIndex().addIndices("index").get().indices();
return indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("index").get().indices();
}
private void assertMinimumCapacity(AutoscalingCapacity.AutoscalingResources resources) {

View file

@ -331,7 +331,7 @@ public class IndexFollowingIT extends CcrIntegTestCase {
assertFalse(response.isIndexFollowingStarted());
// Check that the index exists, would throw index not found exception if the index is missing
followerClient().admin().indices().prepareGetIndex().addIndices("index2").get();
followerClient().admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices("index2").get();
ensureFollowerGreen(true, "index2");
final Map<ShardId, Long> firstBatchNumDocsPerShard = new HashMap<>();

View file

@ -24,6 +24,7 @@ import org.elasticsearch.rest.BaseRestHandler;
import org.elasticsearch.rest.RestRequest;
import org.elasticsearch.rest.RestResponse;
import org.elasticsearch.rest.RestStatus;
import org.elasticsearch.rest.RestUtils;
import org.elasticsearch.rest.action.RestActionListener;
import org.elasticsearch.xcontent.XContentBuilder;
import org.elasticsearch.xcontent.XContentFactory;
@ -105,7 +106,12 @@ public class RestShardChangesAction extends BaseRestHandler {
client.threadPool().executor(Ccr.CCR_THREAD_POOL_NAME)
);
final CompletableFuture<String> indexUUIDCompletableFuture = indexNameCompletableFuture.thenCompose(
concreteIndexName -> asyncGetIndexUUID(client, concreteIndexName, client.threadPool().executor(Ccr.CCR_THREAD_POOL_NAME))
concreteIndexName -> asyncGetIndexUUID(
client,
concreteIndexName,
client.threadPool().executor(Ccr.CCR_THREAD_POOL_NAME),
RestUtils.getMasterNodeTimeout(restRequest)
)
);
final CompletableFuture<ShardStats> shardStatsCompletableFuture = indexNameCompletableFuture.thenCompose(
concreteIndexName -> asyncShardStats(client, concreteIndexName, client.threadPool().executor(Ccr.CCR_THREAD_POOL_NAME))
@ -336,18 +342,20 @@ public class RestShardChangesAction extends BaseRestHandler {
* @param client The NodeClient for executing the asynchronous request.
* @param concreteIndexName The name of the index for which to retrieve the index UUID.
* @param executorService The executorService service for executing the asynchronous task.
* @param masterTimeout The timeout for waiting until the cluster is unblocked.
* @return A CompletableFuture that completes with the retrieved index UUID.
* @throws ElasticsearchException If an error occurs while retrieving the index UUID.
*/
private static CompletableFuture<String> asyncGetIndexUUID(
final NodeClient client,
final String concreteIndexName,
final ExecutorService executorService
final ExecutorService executorService,
TimeValue masterTimeout
) {
return supplyAsyncTask(
() -> client.admin()
.indices()
.prepareGetIndex()
.prepareGetIndex(masterTimeout)
.setIndices(concreteIndexName)
.get(GET_INDEX_UUID_TIMEOUT)
.getSetting(concreteIndexName, IndexMetadata.SETTING_INDEX_UUID),

View file

@ -449,14 +449,18 @@ public abstract class CcrIntegTestCase extends ESTestCase {
}
protected final Index resolveLeaderIndex(String index) {
GetIndexResponse getIndexResponse = leaderClient().admin().indices().prepareGetIndex().setIndices(index).get();
GetIndexResponse getIndexResponse = leaderClient().admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices(index).get();
assertTrue("index " + index + " not found", getIndexResponse.getSettings().containsKey(index));
String uuid = getIndexResponse.getSettings().get(index).get(IndexMetadata.SETTING_INDEX_UUID);
return new Index(index, uuid);
}
protected final Index resolveFollowerIndex(String index) {
GetIndexResponse getIndexResponse = followerClient().admin().indices().prepareGetIndex().setIndices(index).get();
GetIndexResponse getIndexResponse = followerClient().admin()
.indices()
.prepareGetIndex(TEST_REQUEST_TIMEOUT)
.setIndices(index)
.get();
assertTrue("index " + index + " not found", getIndexResponse.getSettings().containsKey(index));
String uuid = getIndexResponse.getSettings().get(index).get(IndexMetadata.SETTING_INDEX_UUID);
return new Index(index, uuid);

View file

@ -72,7 +72,7 @@ public class DataTierAllocationDeciderIT extends ESIntegTestCase {
indicesAdmin().prepareCreate(index).setWaitForActiveShards(0).get();
Settings idxSettings = indicesAdmin().prepareGetIndex().addIndices(index).get().getSettings().get(index);
Settings idxSettings = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(index).get().getSettings().get(index);
assertThat(DataTier.TIER_PREFERENCE_SETTING.get(idxSettings), equalTo(DataTier.DATA_CONTENT));
// index should be red
@ -248,7 +248,7 @@ public class DataTierAllocationDeciderIT extends ESIntegTestCase {
)
.get();
var replicas = indicesAdmin().prepareGetIndex()
var replicas = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.setIndices(index)
.get()
.getSetting(index, INDEX_NUMBER_OF_REPLICAS_SETTING.getKey());
@ -261,7 +261,7 @@ public class DataTierAllocationDeciderIT extends ESIntegTestCase {
updateDesiredNodes(desiredNodesWithoutColdTier);
assertBusy(() -> {
var newReplicaCount = indicesAdmin().prepareGetIndex()
var newReplicaCount = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.setIndices(index)
.get()
.getSetting(index, INDEX_NUMBER_OF_REPLICAS_SETTING.getKey());
@ -280,7 +280,7 @@ public class DataTierAllocationDeciderIT extends ESIntegTestCase {
.setSettings(Settings.builder().put(DataTier.TIER_PREFERENCE, DataTier.DATA_WARM))
.get();
Settings idxSettings = indicesAdmin().prepareGetIndex().addIndices(index).get().getSettings().get(index);
Settings idxSettings = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(index).get().getSettings().get(index);
assertThat(idxSettings.get(DataTier.TIER_PREFERENCE), equalTo(DataTier.DATA_WARM));
// index should be yellow
@ -297,7 +297,7 @@ public class DataTierAllocationDeciderIT extends ESIntegTestCase {
.setSettings(Settings.builder().putNull(DataTier.TIER_PREFERENCE)) // will be overridden to data_content
.get();
Settings idxSettings = indicesAdmin().prepareGetIndex().addIndices(index).get().getSettings().get(index);
Settings idxSettings = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(index).get().getSettings().get(index);
assertThat(DataTier.TIER_PREFERENCE_SETTING.get(idxSettings), equalTo("data_content"));
// index should be yellow
@ -333,7 +333,11 @@ public class DataTierAllocationDeciderIT extends ESIntegTestCase {
ensureGreen(index + "-shrunk");
Settings idxSettings = indicesAdmin().prepareGetIndex().addIndices(index + "-shrunk").get().getSettings().get(index + "-shrunk");
Settings idxSettings = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.addIndices(index + "-shrunk")
.get()
.getSettings()
.get(index + "-shrunk");
// It should inherit the setting of its originator
assertThat(DataTier.TIER_PREFERENCE_SETTING.get(idxSettings), equalTo(DataTier.DATA_WARM));
@ -353,7 +357,7 @@ public class DataTierAllocationDeciderIT extends ESIntegTestCase {
indicesAdmin().prepareCreate(index).setWaitForActiveShards(0).get();
Settings idxSettings = indicesAdmin().prepareGetIndex().addIndices(index).get().getSettings().get(index);
Settings idxSettings = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(index).get().getSettings().get(index);
assertThat(DataTier.TIER_PREFERENCE_SETTING.get(idxSettings), equalTo("data_content"));
// index should be yellow

View file

@ -131,7 +131,10 @@ public class AsyncTaskServiceTests extends ESSingleNodeTestCase {
}
private void assertSettings() {
GetIndexResponse getIndexResponse = client().admin().indices().getIndex(new GetIndexRequest().indices(index)).actionGet();
GetIndexResponse getIndexResponse = client().admin()
.indices()
.getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(index))
.actionGet();
Settings settings = getIndexResponse.getSettings().get(index);
Settings expected = AsyncTaskIndexService.settings();
assertThat(expected, is(settings.filter(expected::hasValue)));

View file

@ -242,7 +242,7 @@ public class DownsampleTransportFailureIT extends ESIntegTestCase {
private void assertIndexExists(final String nodeName, final String indexName) {
final GetIndexResponse getIndexResponse = client(nodeName).admin()
.indices()
.prepareGetIndex()
.prepareGetIndex(TEST_REQUEST_TIMEOUT)
.addIndices(indexName)
.addFeatures(GetIndexRequest.Feature.values())
.get();
@ -255,7 +255,7 @@ public class DownsampleTransportFailureIT extends ESIntegTestCase {
"Index [" + indexName + "] was not deleted",
() -> client(nodeName).admin()
.indices()
.prepareGetIndex()
.prepareGetIndex(TEST_REQUEST_TIMEOUT)
.addIndices(indexName)
.addFeatures(GetIndexRequest.Feature.values())
.get()

View file

@ -203,7 +203,7 @@ public class ILMDownsampleDisruptionIT extends ESIntegTestCase {
final GetIndexResponse getIndexResponse = cluster.client()
.admin()
.indices()
.getIndex(new GetIndexRequest().indices(targetIndex))
.getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(targetIndex))
.actionGet();
assertEquals(1, getIndexResponse.indices().length);
assertResponse(

View file

@ -449,7 +449,9 @@ public class DownsampleActionSingleNodeTests extends ESSingleNodeTestCase {
prepareSourceIndex(sourceIndex, true);
downsample(sourceIndex, downsampleIndex, config);
GetIndexResponse indexSettingsResp = indicesAdmin().prepareGetIndex().addIndices(sourceIndex, downsampleIndex).get();
GetIndexResponse indexSettingsResp = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.addIndices(sourceIndex, downsampleIndex)
.get();
assertDownsampleIndexSettings(sourceIndex, downsampleIndex, indexSettingsResp);
for (String key : settings.keySet()) {
if (LifecycleSettings.LIFECYCLE_NAME_SETTING.getKey().equals(key)) {
@ -605,7 +607,7 @@ public class DownsampleActionSingleNodeTests extends ESSingleNodeTestCase {
);
assertBusy(() -> {
try {
assertEquals(indicesAdmin().prepareGetIndex().addIndices(downsampleIndex).get().getIndices().length, 1);
assertEquals(indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(downsampleIndex).get().getIndices().length, 1);
} catch (IndexNotFoundException e) {
fail("downsample index has not been created");
}
@ -1211,7 +1213,9 @@ public class DownsampleActionSingleNodeTests extends ESSingleNodeTestCase {
assertDownsampleIndexAggregations(sourceIndex, downsampleIndex, config, metricFields, labelFields);
GetIndexResponse indexSettingsResp = indicesAdmin().prepareGetIndex().addIndices(sourceIndex, downsampleIndex).get();
GetIndexResponse indexSettingsResp = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.addIndices(sourceIndex, downsampleIndex)
.get();
assertDownsampleIndexSettings(sourceIndex, downsampleIndex, indexSettingsResp);
Map<String, Map<String, Object>> mappings = (Map<String, Map<String, Object>>) indexSettingsResp.getMappings()

View file

@ -147,7 +147,7 @@ public class EnrichPolicyRunner {
// Collect the source index information
final String[] sourceIndices = policy.getIndices().toArray(new String[0]);
logger.debug("Policy [{}]: Checking source indices [{}]", policyName, sourceIndices);
GetIndexRequest getIndexRequest = new GetIndexRequest().indices(sourceIndices);
GetIndexRequest getIndexRequest = new GetIndexRequest(ENRICH_MASTER_REQUEST_TIMEOUT).indices(sourceIndices);
// This call does not set the origin to ensure that the user executing the policy has permission to access the source index
client.admin().indices().getIndex(getIndexRequest, l);
})

View file

@ -123,8 +123,9 @@ public class TransportDeleteEnrichPolicyAction extends AcknowledgedTransportMast
}
try {
final GetIndexRequest indices = new GetIndexRequest().indices(EnrichPolicy.getBaseName(policyName) + "-*")
.indicesOptions(IndicesOptions.lenientExpand());
final GetIndexRequest indices = new GetIndexRequest(request.masterNodeTimeout()).indices(
EnrichPolicy.getBaseName(policyName) + "-*"
).indicesOptions(IndicesOptions.lenientExpand());
String[] concreteIndices = indexNameExpressionResolver.concreteIndexNamesWithSystemIndexAccess(state, indices);

View file

@ -137,7 +137,10 @@ public class EnrichPolicyMaintenanceServiceTests extends ESSingleNodeTestCase {
}
private void assertEnrichIndicesExist(Set<String> activeIndices) {
GetIndexResponse indices = client().admin().indices().getIndex(new GetIndexRequest().indices(".enrich-*")).actionGet();
GetIndexResponse indices = client().admin()
.indices()
.getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(".enrich-*"))
.actionGet();
assertThat(indices.indices().length, is(equalTo(activeIndices.size())));
for (String index : indices.indices()) {
assertThat(activeIndices.contains(index), is(true));

View file

@ -346,7 +346,8 @@ public class EnrichPolicyRunnerTests extends ESSingleNodeTestCase {
}
private GetIndexResponse getGetIndexResponseAndCheck(String createdEnrichIndex) {
GetIndexResponse enrichIndex = indicesAdmin().getIndex(new GetIndexRequest().indices(".enrich-test1")).actionGet();
GetIndexResponse enrichIndex = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(".enrich-test1"))
.actionGet();
assertThat(enrichIndex.getIndices().length, equalTo(1));
assertThat(enrichIndex.getIndices()[0], equalTo(createdEnrichIndex));
Settings settings = enrichIndex.getSettings().get(createdEnrichIndex);
@ -363,7 +364,8 @@ public class EnrichPolicyRunnerTests extends ESSingleNodeTestCase {
.actionGet();
assertEquals(RestStatus.CREATED, indexRequest.status());
GetIndexResponse sourceIndex = indicesAdmin().getIndex(new GetIndexRequest().indices(sourceIndexName)).actionGet();
GetIndexResponse sourceIndex = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(sourceIndexName))
.actionGet();
// Validate Mapping
Map<String, Object> sourceIndexMapping = sourceIndex.getMappings().get(sourceIndexName).sourceAsMap();
Map<?, ?> sourceIndexProperties = (Map<?, ?>) sourceIndexMapping.get("properties");

View file

@ -142,7 +142,9 @@ public class TransportDeleteEnrichPolicyActionTests extends AbstractEnrichTestCa
createIndex(EnrichPolicy.getIndexName(name, 1001));
createIndex(EnrichPolicy.getIndexName(name, 1002));
indicesAdmin().prepareGetIndex().setIndices(EnrichPolicy.getIndexName(name, 1001), EnrichPolicy.getIndexName(name, 1002)).get();
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.setIndices(EnrichPolicy.getIndexName(name, 1001), EnrichPolicy.getIndexName(name, 1002))
.get();
final CountDownLatch latch = new CountDownLatch(1);
final AtomicReference<AcknowledgedResponse> reference = new AtomicReference<>();
@ -169,7 +171,8 @@ public class TransportDeleteEnrichPolicyActionTests extends AbstractEnrichTestCa
expectThrows(
IndexNotFoundException.class,
indicesAdmin().prepareGetIndex().setIndices(EnrichPolicy.getIndexName(name, 1001), EnrichPolicy.getIndexName(name, 1001))
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.setIndices(EnrichPolicy.getIndexName(name, 1001), EnrichPolicy.getIndexName(name, 1001))
);
if (destructiveRequiresName) {
@ -307,7 +310,7 @@ public class TransportDeleteEnrichPolicyActionTests extends AbstractEnrichTestCa
assertNotNull(EnrichStore.getPolicy(otherName, clusterService.state()));
// and the index associated with the other index should be unaffected
indicesAdmin().prepareGetIndex().setIndices(EnrichPolicy.getIndexName(otherName, 1001)).get();
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices(EnrichPolicy.getIndexName(otherName, 1001)).get();
}
}
}

View file

@ -434,7 +434,10 @@ public class ModelRegistryIT extends ESSingleNodeTestCase {
assertNull(exceptionHolder.get());
assertThat(modelHolder.get(), hasSize(2));
expectThrows(IndexNotFoundException.class, () -> client().admin().indices().prepareGetIndex().addIndices(".inference").get());
expectThrows(
IndexNotFoundException.class,
() -> client().admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(".inference").get()
);
// this time check the index is created
blockingCall(listener -> modelRegistry.getAllModels(true, listener), modelHolder, exceptionHolder);
@ -552,7 +555,7 @@ public class ModelRegistryIT extends ESSingleNodeTestCase {
}
private void assertInferenceIndexExists() {
var indexResponse = client().admin().indices().prepareGetIndex().addIndices(".inference").get();
var indexResponse = client().admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(".inference").get();
assertNotNull(indexResponse.getSettings());
assertNotNull(indexResponse.getMappings());
}

View file

@ -54,7 +54,7 @@ public class CreateIndexFromSourceActionIT extends ESIntegTestCase {
);
try {
indicesAdmin().getIndex(new GetIndexRequest().indices(destIndex)).actionGet();
indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(destIndex)).actionGet();
} catch (IndexNotFoundException e) {
fail();
}

View file

@ -424,7 +424,7 @@ public class ReindexDatastreamIndexTransportActionIT extends ESIntegTestCase {
backingIndexName = indexResponse.getIndex();
}
var sourceSettings = indicesAdmin().getIndex(new GetIndexRequest().indices(backingIndexName))
var sourceSettings = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(backingIndexName))
.actionGet()
.getSettings()
.get(backingIndexName);
@ -446,7 +446,10 @@ public class ReindexDatastreamIndexTransportActionIT extends ESIntegTestCase {
.actionGet()
.getDestIndex();
var destSettings = indicesAdmin().getIndex(new GetIndexRequest().indices(destIndex)).actionGet().getSettings().get(destIndex);
var destSettings = indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(destIndex))
.actionGet()
.getSettings()
.get(destIndex);
var destStart = IndexSettings.TIME_SERIES_START_TIME.get(destSettings);
var destEnd = IndexSettings.TIME_SERIES_END_TIME.get(destSettings);
@ -488,7 +491,7 @@ public class ReindexDatastreamIndexTransportActionIT extends ESIntegTestCase {
}
private static String getIndexUUID(String index) {
return indicesAdmin().getIndex(new GetIndexRequest().indices(index))
return indicesAdmin().getIndex(new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(index))
.actionGet()
.getSettings()
.get(index)

View file

@ -133,7 +133,7 @@ public class DeleteExpiredDataIT extends MlNativeAutodetectIntegTestCase {
client().admin().indices().prepareCreate(".ml-state-000007").addAlias(new Alias(".ml-state-write").isHidden(true)).get();
refresh();
GetIndexResponse getIndexResponse = client().admin().indices().prepareGetIndex().setIndices(".ml-state*").get();
GetIndexResponse getIndexResponse = client().admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices(".ml-state*").get();
assertThat(
Strings.toString(getIndexResponse),
getIndexResponse.getIndices(),
@ -143,7 +143,7 @@ public class DeleteExpiredDataIT extends MlNativeAutodetectIntegTestCase {
client().execute(DeleteExpiredDataAction.INSTANCE, new DeleteExpiredDataAction.Request()).get();
refresh();
getIndexResponse = client().admin().indices().prepareGetIndex().setIndices(".ml-state*").get();
getIndexResponse = client().admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices(".ml-state*").get();
assertThat(
Strings.toString(getIndexResponse),
getIndexResponse.getIndices(),

View file

@ -404,7 +404,7 @@ abstract class MlNativeDataFrameAnalyticsIntegTestCase extends MlNativeIntegTest
}
protected static void assertMlResultsFieldMappings(String index, String predictedClassField, String expectedType) {
Map<String, Object> mappings = client().execute(GetIndexAction.INSTANCE, new GetIndexRequest().indices(index))
Map<String, Object> mappings = client().execute(GetIndexAction.INSTANCE, new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices(index))
.actionGet()
.mappings()
.get(index)

View file

@ -129,7 +129,9 @@ public class TestFeatureResetIT extends MlNativeAutodetectIntegTestCase {
);
client().execute(ResetFeatureStateAction.INSTANCE, new ResetFeatureStateRequest(TEST_REQUEST_TIMEOUT)).actionGet();
assertBusy(() -> {
List<String> indices = Arrays.asList(client().admin().indices().prepareGetIndex().addIndices(".ml*").get().indices());
List<String> indices = Arrays.asList(
client().admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(".ml*").get().indices()
);
assertThat(indices.toString(), indices, is(empty()));
});
assertThat(isResetMode(), is(false));
@ -160,7 +162,9 @@ public class TestFeatureResetIT extends MlNativeAutodetectIntegTestCase {
createModelDeployment();
client().execute(ResetFeatureStateAction.INSTANCE, new ResetFeatureStateRequest(TEST_REQUEST_TIMEOUT)).actionGet();
assertBusy(() -> {
List<String> indices = Arrays.asList(client().admin().indices().prepareGetIndex().addIndices(".ml*").get().indices());
List<String> indices = Arrays.asList(
client().admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(".ml*").get().indices()
);
assertThat(indices.toString(), indices, is(empty()));
});
assertThat(isResetMode(), is(false));

View file

@ -321,7 +321,7 @@ public class AnnotationIndexIT extends MlSingleNodeTestCase {
}
private boolean annotationsIndexExists(String expectedName) {
GetIndexResponse getIndexResponse = indicesAdmin().prepareGetIndex()
GetIndexResponse getIndexResponse = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.setIndices(AnnotationIndex.LATEST_INDEX_NAME)
.setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN)
.get();

View file

@ -60,7 +60,12 @@ public class IndexLayoutIT extends BaseMlIntegTestCase {
OriginSettingClient client = new OriginSettingClient(client(), ML_ORIGIN);
assertThat(
client.admin().indices().prepareGetIndex().addIndices(AnomalyDetectorsIndex.jobStateIndexPattern()).get().indices(),
client.admin()
.indices()
.prepareGetIndex(TEST_REQUEST_TIMEOUT)
.addIndices(AnomalyDetectorsIndex.jobStateIndexPattern())
.get()
.indices(),
arrayContaining(".ml-state-000001")
);
assertThat(
@ -77,7 +82,7 @@ public class IndexLayoutIT extends BaseMlIntegTestCase {
assertThat(
client.admin()
.indices()
.prepareGetIndex()
.prepareGetIndex(TEST_REQUEST_TIMEOUT)
.addIndices(AnomalyDetectorsIndex.jobResultsAliasedName(jobId))
.get()
.indices().length,
@ -86,7 +91,7 @@ public class IndexLayoutIT extends BaseMlIntegTestCase {
assertThat(
client.admin()
.indices()
.prepareGetIndex()
.prepareGetIndex(TEST_REQUEST_TIMEOUT)
.addIndices(AnomalyDetectorsIndex.jobResultsAliasedName(jobId2))
.get()
.indices().length,
@ -137,7 +142,12 @@ public class IndexLayoutIT extends BaseMlIntegTestCase {
OriginSettingClient client = new OriginSettingClient(client(), ML_ORIGIN);
assertThat(
client.admin().indices().prepareGetIndex().addIndices(AnomalyDetectorsIndex.jobStateIndexPattern()).get().indices(),
client.admin()
.indices()
.prepareGetIndex(TEST_REQUEST_TIMEOUT)
.addIndices(AnomalyDetectorsIndex.jobStateIndexPattern())
.get()
.indices(),
arrayContaining(".ml-state-000001")
);

View file

@ -195,7 +195,7 @@ public class JobStorageDeletionTaskIT extends BaseMlIntegTestCase {
// Make sure dedicated index is gone
assertThat(
indicesAdmin().prepareGetIndex()
indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT)
.setIndices(dedicatedIndex)
.setIndicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN_CLOSED_HIDDEN)
.get()

View file

@ -97,7 +97,12 @@ public class TrainedModelCRUDIT extends MlSingleNodeTestCase {
).actionGet();
assertThat(
client().admin().indices().prepareGetIndex().addIndices(InferenceIndexConstants.nativeDefinitionStore()).get().indices().length,
client().admin()
.indices()
.prepareGetIndex(TEST_REQUEST_TIMEOUT)
.addIndices(InferenceIndexConstants.nativeDefinitionStore())
.get()
.indices().length,
equalTo(1)
);

View file

@ -40,6 +40,7 @@ import org.elasticsearch.xpack.core.ClientHelper;
import org.elasticsearch.xpack.core.ml.dataframe.DataFrameAnalyticsConfig;
import org.elasticsearch.xpack.core.ml.job.messages.Messages;
import org.elasticsearch.xpack.core.ml.utils.ExceptionsHelper;
import org.elasticsearch.xpack.ml.MachineLearning;
import org.elasticsearch.xpack.ml.dataframe.DataFrameAnalyticsTask;
import org.elasticsearch.xpack.ml.dataframe.DestinationIndex;
import org.elasticsearch.xpack.ml.notifications.DataFrameAnalyticsAuditor;
@ -225,7 +226,7 @@ public class ReindexingStep extends AbstractDataFrameAnalyticsStep {
ML_ORIGIN,
parentTaskClient,
GetIndexAction.INSTANCE,
new GetIndexRequest().indices(config.getDest().getIndex()),
new GetIndexRequest(MachineLearning.HARD_CODED_MACHINE_LEARNING_MASTER_NODE_TIMEOUT).indices(config.getDest().getIndex()),
destIndexListener
);
}

View file

@ -15,6 +15,7 @@ import org.elasticsearch.client.internal.OriginSettingClient;
import org.elasticsearch.common.util.set.Sets;
import org.elasticsearch.tasks.TaskId;
import org.elasticsearch.xpack.core.ml.job.persistence.AnomalyDetectorsIndex;
import org.elasticsearch.xpack.ml.MachineLearning;
import java.util.Objects;
import java.util.Set;
@ -82,7 +83,9 @@ public class EmptyStateIndexRemover implements MlDataRemover {
}
private void getCurrentStateIndices(ActionListener<Set<String>> listener) {
GetIndexRequest getIndexRequest = new GetIndexRequest().indices(AnomalyDetectorsIndex.jobStateIndexWriteAlias());
GetIndexRequest getIndexRequest = new GetIndexRequest(MachineLearning.HARD_CODED_MACHINE_LEARNING_MASTER_NODE_TIMEOUT).indices(
AnomalyDetectorsIndex.jobStateIndexWriteAlias()
);
getIndexRequest.setParentTask(parentTaskId);
client.admin()
.indices()

View file

@ -527,7 +527,7 @@ public class TransportMonitoringMigrateAlertsActionTests extends MonitoringInteg
private void assertWatchesExist(boolean exist) {
// Check if watches index exists
if (client().admin().indices().prepareGetIndex().addIndices(".watches").get().getIndices().length == 0) {
if (client().admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(".watches").get().getIndices().length == 0) {
fail("Expected [.watches] index with cluster alerts present, but no [.watches] index was found");
}

View file

@ -257,7 +257,7 @@ public class LocalExporterResourceIntegTests extends LocalExporterIntegTestCase
private void assertWatchesExist() {
// Check if watches index exists
if (client().admin().indices().prepareGetIndex().addIndices(".watches").get().getIndices().length == 0) {
if (client().admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(".watches").get().getIndices().length == 0) {
fail("Expected [.watches] index with cluster alerts present, but no [.watches] index was found");
}
@ -284,7 +284,7 @@ public class LocalExporterResourceIntegTests extends LocalExporterIntegTestCase
private void assertNoWatchesExist() {
// Check if watches index exists
if (client().admin().indices().prepareGetIndex().addIndices(".watches").get().getIndices().length == 0) {
if (client().admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(".watches").get().getIndices().length == 0) {
fail("Expected [.watches] index with cluster alerts present, but no [.watches] index was found");
}

View file

@ -263,7 +263,7 @@ public class IndexResolver {
) {
if (retrieveIndices || retrieveFrozenIndices) {
if (clusterIsLocal(clusterWildcard)) { // resolve local indices
GetIndexRequest indexRequest = new GetIndexRequest().local(true)
GetIndexRequest indexRequest = new GetIndexRequest(MasterNodeRequest.INFINITE_MASTER_NODE_TIMEOUT).local(true)
.indices(indexWildcards)
.features(Feature.SETTINGS)
.includeDefaults(false)

View file

@ -153,7 +153,7 @@ public class SearchableSnapshotsBlobStoreCacheIntegTests extends BaseFrozenSearc
expectThrows(
IndexNotFoundException.class,
".snapshot-blob-cache system index should not be created yet",
() -> systemClient().admin().indices().prepareGetIndex().addIndices(SNAPSHOT_BLOB_CACHE_INDEX).get()
() -> systemClient().admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).addIndices(SNAPSHOT_BLOB_CACHE_INDEX).get()
);
final Storage storage1 = randomFrom(Storage.values());

View file

@ -321,25 +321,25 @@ public class DocumentAndFieldLevelSecurityTests extends SecurityIntegTestCase {
{
GetIndexResponse getIndexResponse = client().filterWithHeader(
Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user1", USERS_PASSWD))
).admin().indices().prepareGetIndex().setIndices("test").get();
).admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices("test").get();
assertExpectedMetadataFields(getIndexResponse.getMappings(), "field1");
}
{
GetIndexResponse getIndexResponse = client().filterWithHeader(
Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user2", USERS_PASSWD))
).admin().indices().prepareGetIndex().setIndices("test").get();
).admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices("test").get();
assertExpectedMetadataFields(getIndexResponse.getMappings(), "field2");
}
{
GetIndexResponse getIndexResponse = client().filterWithHeader(
Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user3", USERS_PASSWD))
).admin().indices().prepareGetIndex().setIndices("test").get();
).admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices("test").get();
assertExpectedMetadataFields(getIndexResponse.getMappings(), "field1");
}
{
GetIndexResponse getIndexResponse = client().filterWithHeader(
Collections.singletonMap(BASIC_AUTH_HEADER, basicAuthHeaderValue("user4", USERS_PASSWD))
).admin().indices().prepareGetIndex().setIndices("test").get();
).admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices("test").get();
assertExpectedMetadataFields(getIndexResponse.getMappings(), "field1", "field2");
}
}

View file

@ -149,12 +149,12 @@ public class KibanaUserRoleIntegTests extends NativeRealmIntegTestCase {
final String field = "foo";
indexRandom(true, prepareIndex(index).setSource(field, "bar"));
GetIndexResponse response = indicesAdmin().prepareGetIndex().setIndices(index).get();
GetIndexResponse response = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices(index).get();
assertThat(response.getIndices(), arrayContaining(index));
response = client().filterWithHeader(
singletonMap("Authorization", UsernamePasswordToken.basicAuthHeaderValue("kibana_user", USERS_PASSWD))
).admin().indices().prepareGetIndex().setIndices(index).get();
).admin().indices().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices(index).get();
assertThat(response.getIndices(), arrayContaining(index));
}

View file

@ -29,7 +29,7 @@ public class DestructiveOperationsTests extends SecurityIntegTestCase {
() -> indicesAdmin().prepareDelete("*").get()
);
assertEquals("Wildcard expressions or all indices are not allowed", illegalArgumentException.getMessage());
String[] indices = indicesAdmin().prepareGetIndex().setIndices("index1").get().getIndices();
String[] indices = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices("index1").get().getIndices();
assertEquals(1, indices.length);
assertEquals("index1", indices[0]);
}
@ -39,7 +39,7 @@ public class DestructiveOperationsTests extends SecurityIntegTestCase {
() -> indicesAdmin().prepareDelete("*", "-index1").get()
);
assertEquals("Wildcard expressions or all indices are not allowed", illegalArgumentException.getMessage());
String[] indices = indicesAdmin().prepareGetIndex().setIndices("index1").get().getIndices();
String[] indices = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices("index1").get().getIndices();
assertEquals(1, indices.length);
assertEquals("index1", indices[0]);
}
@ -49,7 +49,7 @@ public class DestructiveOperationsTests extends SecurityIntegTestCase {
() -> indicesAdmin().prepareDelete("_all").get()
);
assertEquals("Wildcard expressions or all indices are not allowed", illegalArgumentException.getMessage());
String[] indices = indicesAdmin().prepareGetIndex().setIndices("index1").get().getIndices();
String[] indices = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices("index1").get().getIndices();
assertEquals(1, indices.length);
assertEquals("index1", indices[0]);
}

View file

@ -100,7 +100,7 @@ public class ReservedRealmElasticAutoconfigIntegTests extends SecuritySingleNode
assertAcked(clusterAdmin().updateSettings(updateSettingsRequest).actionGet());
// delete the security index, if it exist
GetIndexRequest getIndexRequest = new GetIndexRequest();
GetIndexRequest getIndexRequest = new GetIndexRequest(TEST_REQUEST_TIMEOUT);
getIndexRequest.indices(SECURITY_MAIN_ALIAS);
getIndexRequest.indicesOptions(IndicesOptions.lenientExpandOpen());
GetIndexResponse getIndexResponse = client().admin().indices().getIndex(getIndexRequest).actionGet();

View file

@ -77,7 +77,7 @@ public class SnapshotUserRoleIntegTests extends NativeRealmIntegTestCase {
// view all indices, including restricted ones
final GetIndexResponse getIndexResponse = client.admin()
.indices()
.prepareGetIndex()
.prepareGetIndex(TEST_REQUEST_TIMEOUT)
.setIndices(randomFrom("_all", "*"))
.setIndicesOptions(IndicesOptions.strictExpandHidden())
.get();

View file

@ -872,7 +872,7 @@ public class ProfileIntegTests extends AbstractProfileIntegTestCase {
}
private GetIndexResponse getProfileIndexResponse() {
final GetIndexRequest getIndexRequest = new GetIndexRequest();
final GetIndexRequest getIndexRequest = new GetIndexRequest(TEST_REQUEST_TIMEOUT);
getIndexRequest.indices(".*");
return client().execute(GetIndexAction.INSTANCE, getIndexRequest).actionGet();
}

View file

@ -274,7 +274,7 @@ public class SecurityIndexManagerIntegTests extends SecurityIntegTestCase {
public void testSecurityIndexSettingsCannotBeChanged() throws Exception {
// make sure the security index is not auto-created
GetIndexRequest getIndexRequest = new GetIndexRequest();
GetIndexRequest getIndexRequest = new GetIndexRequest(TEST_REQUEST_TIMEOUT);
getIndexRequest.indices(SECURITY_MAIN_ALIAS);
getIndexRequest.indicesOptions(IndicesOptions.lenientExpandOpen());
GetIndexResponse getIndexResponse = client().admin().indices().getIndex(getIndexRequest).actionGet();

View file

@ -416,7 +416,7 @@ public abstract class SecurityIntegTestCase extends ESIntegTestCase {
)
)
);
GetIndexRequest getIndexRequest = new GetIndexRequest();
GetIndexRequest getIndexRequest = new GetIndexRequest(TEST_REQUEST_TIMEOUT);
getIndexRequest.indices(SECURITY_MAIN_ALIAS);
getIndexRequest.indicesOptions(IndicesOptions.lenientExpandOpen());
GetIndexResponse getIndexResponse = client.admin().indices().getIndex(getIndexRequest).actionGet();

View file

@ -1391,7 +1391,7 @@ public class AuthorizationServiceTests extends ESTestCase {
}
public void testAuthorizeIndicesFailures() {
TransportRequest request = new GetIndexRequest().indices("b");
TransportRequest request = new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices("b");
ClusterState state = mockEmptyMetadata();
RoleDescriptor role = new RoleDescriptor(
"a_all",
@ -1726,7 +1726,7 @@ public class AuthorizationServiceTests extends ESTestCase {
}
public void testDenialForAnonymousUser() {
TransportRequest request = new GetIndexRequest().indices("b");
TransportRequest request = new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices("b");
ClusterState state = mockEmptyMetadata();
Settings settings = Settings.builder().put(AnonymousUser.ROLES_SETTING.getKey(), "a_all").build();
final AnonymousUser anonymousUser = new AnonymousUser(settings);
@ -1772,7 +1772,7 @@ public class AuthorizationServiceTests extends ESTestCase {
}
public void testDenialForAnonymousUserAuthorizationExceptionDisabled() {
TransportRequest request = new GetIndexRequest().indices("b");
TransportRequest request = new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices("b");
ClusterState state = mockEmptyMetadata();
Settings settings = Settings.builder()
.put(AnonymousUser.ROLES_SETTING.getKey(), "a_all")
@ -1825,7 +1825,7 @@ public class AuthorizationServiceTests extends ESTestCase {
public void testAuditTrailIsRecordedWhenIndexWildcardThrowsError() {
IndicesOptions options = IndicesOptions.fromOptions(false, false, true, true);
TransportRequest request = new GetIndexRequest().indices("not-an-index-*").indicesOptions(options);
TransportRequest request = new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices("not-an-index-*").indicesOptions(options);
ClusterState state = mockEmptyMetadata();
RoleDescriptor role = new RoleDescriptor(
"a_all",
@ -1929,7 +1929,7 @@ public class AuthorizationServiceTests extends ESTestCase {
}
public void testRunAsRequestWithRunAsUserWithoutPermission() {
TransportRequest request = new GetIndexRequest().indices("a");
TransportRequest request = new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices("a");
User authenticatedUser = new User("test user", "can run as");
final Authentication authentication = createAuthentication(new User("run as me", "b"), authenticatedUser);
final RoleDescriptor runAsRole = new RoleDescriptor(
@ -1989,7 +1989,7 @@ public class AuthorizationServiceTests extends ESTestCase {
}
public void testRunAsRequestWithValidPermissions() {
TransportRequest request = new GetIndexRequest().indices("b");
TransportRequest request = new GetIndexRequest(TEST_REQUEST_TIMEOUT).indices("b");
User authenticatedUser = new User("test user", "can run as");
final Authentication authentication = createAuthentication(new User("run as me", "b"), authenticatedUser);
final RoleDescriptor runAsRole = new RoleDescriptor(

View file

@ -33,6 +33,7 @@ import org.elasticsearch.xpack.core.transform.transforms.TransformCheckpointingI
import org.elasticsearch.xpack.core.transform.transforms.TransformConfig;
import org.elasticsearch.xpack.core.transform.transforms.TransformIndexerPosition;
import org.elasticsearch.xpack.core.transform.transforms.TransformProgress;
import org.elasticsearch.xpack.transform.Transform;
import org.elasticsearch.xpack.transform.checkpoint.RemoteClusterResolver.ResolvedIndices;
import org.elasticsearch.xpack.transform.notifications.TransformAuditor;
import org.elasticsearch.xpack.transform.persistence.TransformConfigManager;
@ -281,7 +282,7 @@ class DefaultCheckpointProvider implements CheckpointProvider {
ActionListener<Map<String, long[]>> listener
) {
// 1st get index to see the indexes the user has access to
GetIndexRequest getIndexRequest = new GetIndexRequest().indices(indices)
GetIndexRequest getIndexRequest = new GetIndexRequest(Transform.HARD_CODED_TRANSFORM_MASTER_NODE_TIMEOUT).indices(indices)
.features(new GetIndexRequest.Feature[0])
.indicesOptions(IndicesOptions.LENIENT_EXPAND_OPEN);

View file

@ -35,6 +35,7 @@ import org.elasticsearch.xpack.core.transform.transforms.DestAlias;
import org.elasticsearch.xpack.core.transform.transforms.TransformConfig;
import org.elasticsearch.xpack.core.transform.transforms.TransformDestIndexSettings;
import org.elasticsearch.xpack.core.transform.transforms.TransformEffectiveSettings;
import org.elasticsearch.xpack.transform.Transform;
import org.elasticsearch.xpack.transform.notifications.TransformAuditor;
import java.time.Clock;
@ -66,7 +67,7 @@ public final class TransformIndex {
* Returns {@code true} if the given index was created by the transform and {@code false} otherwise.
*/
public static void isDestinationIndexCreatedByTransform(Client client, String destIndex, ActionListener<Boolean> listener) {
GetIndexRequest getIndexRequest = new GetIndexRequest().indices(destIndex)
GetIndexRequest getIndexRequest = new GetIndexRequest(Transform.HARD_CODED_TRANSFORM_MASTER_NODE_TIMEOUT).indices(destIndex)
// We only need mappings, more specifically its "_meta" part
.features(GetIndexRequest.Feature.MAPPINGS);
executeAsyncWithOrigin(client, TRANSFORM_ORIGIN, GetIndexAction.INSTANCE, getIndexRequest, ActionListener.wrap(getIndexResponse -> {

View file

@ -266,7 +266,7 @@ public abstract class AbstractWatcherIntegrationTestCase extends ESIntegTestCase
}
public void replaceWatcherIndexWithRandomlyNamedIndex(String originalIndexOrAlias, String to) {
GetIndexResponse index = indicesAdmin().prepareGetIndex().setIndices(originalIndexOrAlias).get();
GetIndexResponse index = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices(originalIndexOrAlias).get();
MappingMetadata mapping = index.getMappings().get(index.getIndices()[0]);
Settings settings = index.getSettings().get(index.getIndices()[0]);

View file

@ -62,7 +62,7 @@ public class GetWatchTests extends AbstractWatcherIntegrationTestCase {
// if the watches index is an alias, remove the alias randomly, otherwise the index
if (randomBoolean()) {
try {
GetIndexResponse indexResponse = indicesAdmin().prepareGetIndex().setIndices(Watch.INDEX).get();
GetIndexResponse indexResponse = indicesAdmin().prepareGetIndex(TEST_REQUEST_TIMEOUT).setIndices(Watch.INDEX).get();
boolean isWatchIndexAlias = Watch.INDEX.equals(indexResponse.indices()[0]) == false;
if (isWatchIndexAlias) {
assertAcked(indicesAdmin().prepareAliases().removeAlias(indexResponse.indices()[0], Watch.INDEX));