mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 01:22:26 -04:00
Remove some more ActionType subclasses (#103055)
Cleaned up a few more of these.
This commit is contained in:
parent
b0ae25504a
commit
e20821f13e
139 changed files with 1133 additions and 1111 deletions
|
@ -11,9 +11,9 @@ package org.elasticsearch.analysis.common;
|
|||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction.AnalyzeToken;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction.Response;
|
||||
import org.elasticsearch.action.admin.indices.analyze.ReloadAnalyzerAction;
|
||||
import org.elasticsearch.action.admin.indices.analyze.ReloadAnalyzersRequest;
|
||||
import org.elasticsearch.action.admin.indices.analyze.ReloadAnalyzersResponse;
|
||||
import org.elasticsearch.action.admin.indices.analyze.TransportReloadAnalyzersAction;
|
||||
import org.elasticsearch.index.mapper.MapperException;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
|
@ -121,7 +121,7 @@ public class ReloadAnalyzerTests extends ESSingleNodeTestCase {
|
|||
out.println("foo, baz, buzz");
|
||||
}
|
||||
ReloadAnalyzersResponse reloadResponse = client().execute(
|
||||
ReloadAnalyzerAction.INSTANCE,
|
||||
TransportReloadAnalyzersAction.TYPE,
|
||||
new ReloadAnalyzersRequest(null, preview, INDEX_NAME)
|
||||
).actionGet();
|
||||
assertNoFailures(reloadResponse);
|
||||
|
@ -183,7 +183,7 @@ public class ReloadAnalyzerTests extends ESSingleNodeTestCase {
|
|||
out.println("foo, baz, buzz");
|
||||
}
|
||||
ReloadAnalyzersResponse reloadResponse = client().execute(
|
||||
ReloadAnalyzerAction.INSTANCE,
|
||||
TransportReloadAnalyzersAction.TYPE,
|
||||
new ReloadAnalyzersRequest(null, false, INDEX_NAME)
|
||||
).actionGet();
|
||||
assertNoFailures(reloadResponse);
|
||||
|
@ -303,7 +303,7 @@ public class ReloadAnalyzerTests extends ESSingleNodeTestCase {
|
|||
}
|
||||
|
||||
ReloadAnalyzersResponse reloadResponse = client().execute(
|
||||
ReloadAnalyzerAction.INSTANCE,
|
||||
TransportReloadAnalyzersAction.TYPE,
|
||||
new ReloadAnalyzersRequest(null, false, INDEX_NAME)
|
||||
).actionGet();
|
||||
assertNoFailures(reloadResponse);
|
||||
|
|
|
@ -10,9 +10,9 @@ package org.elasticsearch.analysis.common;
|
|||
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction.AnalyzeToken;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction.Response;
|
||||
import org.elasticsearch.action.admin.indices.analyze.ReloadAnalyzerAction;
|
||||
import org.elasticsearch.action.admin.indices.analyze.ReloadAnalyzersRequest;
|
||||
import org.elasticsearch.action.admin.indices.analyze.ReloadAnalyzersResponse;
|
||||
import org.elasticsearch.action.admin.indices.analyze.TransportReloadAnalyzersAction;
|
||||
import org.elasticsearch.env.Environment;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.plugins.Plugin;
|
||||
|
@ -91,7 +91,7 @@ public class ReloadSynonymAnalyzerIT extends ESIntegTestCase {
|
|||
out.println("foo, baz, " + testTerm);
|
||||
}
|
||||
ReloadAnalyzersResponse reloadResponse = client().execute(
|
||||
ReloadAnalyzerAction.INSTANCE,
|
||||
TransportReloadAnalyzersAction.TYPE,
|
||||
new ReloadAnalyzersRequest(null, preview, "test")
|
||||
).actionGet();
|
||||
assertNoFailures(reloadResponse);
|
||||
|
|
|
@ -21,9 +21,9 @@ import org.elasticsearch.action.admin.indices.flush.FlushResponse;
|
|||
import org.elasticsearch.action.admin.indices.refresh.RefreshAction;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.block.ClusterBlockException;
|
||||
import org.elasticsearch.cluster.block.ClusterBlocks;
|
||||
|
@ -221,7 +221,7 @@ public class GeoIpDownloaderTests extends ESTestCase {
|
|||
|
||||
AtomicInteger chunkIndex = new AtomicInteger();
|
||||
|
||||
client.addHandler(IndexAction.INSTANCE, (IndexRequest request, ActionListener<DocWriteResponse> listener) -> {
|
||||
client.addHandler(TransportIndexAction.TYPE, (IndexRequest request, ActionListener<DocWriteResponse> listener) -> {
|
||||
int chunk = chunkIndex.getAndIncrement();
|
||||
assertEquals(OpType.CREATE, request.opType());
|
||||
assertThat(request.id(), Matchers.startsWith("test_" + (chunk + 15) + "_"));
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
package org.elasticsearch.http;
|
||||
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
|
||||
import org.elasticsearch.action.support.PlainActionFuture;
|
||||
import org.elasticsearch.client.Cancellable;
|
||||
import org.elasticsearch.client.Request;
|
||||
|
@ -73,14 +73,14 @@ public class ClusterHealthRestCancellationIT extends HttpSmokeTestCase {
|
|||
|
||||
safeAwait(barrier);
|
||||
|
||||
awaitTaskWithPrefixOnMaster(ClusterHealthAction.NAME);
|
||||
awaitTaskWithPrefixOnMaster(TransportClusterHealthAction.NAME);
|
||||
|
||||
logger.info("--> cancelling cluster health request");
|
||||
cancellable.cancel();
|
||||
expectThrows(CancellationException.class, future::actionGet);
|
||||
|
||||
logger.info("--> checking cluster health task cancelled");
|
||||
assertAllCancellableTasksAreCancelled(ClusterHealthAction.NAME);
|
||||
assertAllCancellableTasksAreCancelled(TransportClusterHealthAction.NAME);
|
||||
|
||||
safeAwait(barrier);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ package org.elasticsearch.http;
|
|||
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.state.ClusterStateAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.recovery.RecoveryAction;
|
||||
|
@ -50,7 +50,7 @@ public class RestActionCancellationIT extends HttpSmokeTestCase {
|
|||
}
|
||||
|
||||
public void testClusterHealthRestCancellation() {
|
||||
runRestActionCancellationTest(new Request(HttpGet.METHOD_NAME, "/_cluster/health"), ClusterHealthAction.NAME);
|
||||
runRestActionCancellationTest(new Request(HttpGet.METHOD_NAME, "/_cluster/health"), TransportClusterHealthAction.NAME);
|
||||
}
|
||||
|
||||
public void testClusterStateRestCancellation() {
|
||||
|
|
|
@ -12,8 +12,8 @@ import org.elasticsearch.action.admin.indices.alias.Alias;
|
|||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheAction;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.close.TransportCloseIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.flush.FlushRequest;
|
||||
|
@ -47,12 +47,12 @@ import org.elasticsearch.action.bulk.BulkRequest;
|
|||
import org.elasticsearch.action.delete.DeleteRequest;
|
||||
import org.elasticsearch.action.explain.ExplainRequest;
|
||||
import org.elasticsearch.action.explain.TransportExplainAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest;
|
||||
import org.elasticsearch.action.get.GetAction;
|
||||
import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.get.MultiGetAction;
|
||||
import org.elasticsearch.action.get.MultiGetRequest;
|
||||
import org.elasticsearch.action.get.TransportGetAction;
|
||||
import org.elasticsearch.action.get.TransportMultiGetAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchTransportService;
|
||||
|
@ -62,7 +62,7 @@ import org.elasticsearch.action.termvectors.MultiTermVectorsAction;
|
|||
import org.elasticsearch.action.termvectors.MultiTermVectorsRequest;
|
||||
import org.elasticsearch.action.termvectors.TermVectorsAction;
|
||||
import org.elasticsearch.action.termvectors.TermVectorsRequest;
|
||||
import org.elasticsearch.action.update.UpdateAction;
|
||||
import org.elasticsearch.action.update.TransportUpdateAction;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
import org.elasticsearch.action.update.UpdateResponse;
|
||||
import org.elasticsearch.client.internal.Requests;
|
||||
|
@ -181,7 +181,7 @@ public class IndicesRequestIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testFieldCapabilities() {
|
||||
String fieldCapabilitiesShardAction = FieldCapabilitiesAction.NAME + "[n]";
|
||||
String fieldCapabilitiesShardAction = TransportFieldCapabilitiesAction.NAME + "[n]";
|
||||
interceptTransportActions(fieldCapabilitiesShardAction);
|
||||
|
||||
FieldCapabilitiesRequest fieldCapabilitiesRequest = new FieldCapabilitiesRequest();
|
||||
|
@ -229,7 +229,10 @@ public class IndicesRequestIT extends ESIntegTestCase {
|
|||
|
||||
public void testUpdate() {
|
||||
// update action goes to the primary, index op gets executed locally, then replicated
|
||||
String[] updateShardActions = new String[] { UpdateAction.NAME + "[s]", BulkAction.NAME + "[s][p]", BulkAction.NAME + "[s][r]" };
|
||||
String[] updateShardActions = new String[] {
|
||||
TransportUpdateAction.NAME + "[s]",
|
||||
BulkAction.NAME + "[s][p]",
|
||||
BulkAction.NAME + "[s][r]" };
|
||||
interceptTransportActions(updateShardActions);
|
||||
|
||||
String indexOrAlias = randomIndexOrAlias();
|
||||
|
@ -244,7 +247,10 @@ public class IndicesRequestIT extends ESIntegTestCase {
|
|||
|
||||
public void testUpdateUpsert() {
|
||||
// update action goes to the primary, index op gets executed locally, then replicated
|
||||
String[] updateShardActions = new String[] { UpdateAction.NAME + "[s]", BulkAction.NAME + "[s][p]", BulkAction.NAME + "[s][r]" };
|
||||
String[] updateShardActions = new String[] {
|
||||
TransportUpdateAction.NAME + "[s]",
|
||||
BulkAction.NAME + "[s][p]",
|
||||
BulkAction.NAME + "[s][r]" };
|
||||
interceptTransportActions(updateShardActions);
|
||||
|
||||
String indexOrAlias = randomIndexOrAlias();
|
||||
|
@ -259,7 +265,10 @@ public class IndicesRequestIT extends ESIntegTestCase {
|
|||
|
||||
public void testUpdateDelete() {
|
||||
// update action goes to the primary, delete op gets executed locally, then replicated
|
||||
String[] updateShardActions = new String[] { UpdateAction.NAME + "[s]", BulkAction.NAME + "[s][p]", BulkAction.NAME + "[s][r]" };
|
||||
String[] updateShardActions = new String[] {
|
||||
TransportUpdateAction.NAME + "[s]",
|
||||
BulkAction.NAME + "[s][p]",
|
||||
BulkAction.NAME + "[s][r]" };
|
||||
interceptTransportActions(updateShardActions);
|
||||
|
||||
String indexOrAlias = randomIndexOrAlias();
|
||||
|
@ -306,7 +315,7 @@ public class IndicesRequestIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testGet() {
|
||||
String getShardAction = GetAction.NAME + "[s]";
|
||||
String getShardAction = TransportGetAction.TYPE.name() + "[s]";
|
||||
interceptTransportActions(getShardAction);
|
||||
|
||||
GetRequest getRequest = new GetRequest(randomIndexOrAlias(), "id");
|
||||
|
@ -357,7 +366,7 @@ public class IndicesRequestIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testMultiGet() {
|
||||
String multiGetShardAction = MultiGetAction.NAME + "[shard][s]";
|
||||
String multiGetShardAction = TransportMultiGetAction.NAME + "[shard][s]";
|
||||
interceptTransportActions(multiGetShardAction);
|
||||
|
||||
List<String> indicesOrAliases = new ArrayList<>();
|
||||
|
@ -483,13 +492,13 @@ public class IndicesRequestIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testCloseIndex() {
|
||||
interceptTransportActions(CloseIndexAction.NAME);
|
||||
interceptTransportActions(TransportCloseIndexAction.NAME);
|
||||
|
||||
CloseIndexRequest closeIndexRequest = new CloseIndexRequest(randomUniqueIndicesOrAliases());
|
||||
internalCluster().coordOnlyNodeClient().admin().indices().close(closeIndexRequest).actionGet();
|
||||
|
||||
clearInterceptedActions();
|
||||
assertSameIndices(closeIndexRequest, CloseIndexAction.NAME);
|
||||
assertSameIndices(closeIndexRequest, TransportCloseIndexAction.NAME);
|
||||
}
|
||||
|
||||
public void testDeleteIndex() {
|
||||
|
|
|
@ -15,7 +15,7 @@ import org.elasticsearch.action.ActionListener;
|
|||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.FailedNodeException;
|
||||
import org.elasticsearch.action.TaskOperationFailure;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksResponse;
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskRequest;
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.get.GetTaskResponse;
|
||||
|
@ -25,7 +25,7 @@ import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeAction;
|
|||
import org.elasticsearch.action.admin.indices.refresh.RefreshAction;
|
||||
import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryAction;
|
||||
import org.elasticsearch.action.bulk.BulkAction;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.search.SearchTransportService;
|
||||
import org.elasticsearch.action.search.TransportSearchAction;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
|
@ -136,24 +136,24 @@ public class TasksIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
public void testMasterNodeOperationTasks() throws Exception {
|
||||
registerTaskManagerListeners(ClusterHealthAction.NAME);
|
||||
registerTaskManagerListeners(TransportClusterHealthAction.NAME);
|
||||
|
||||
// First run the health on the master node - should produce only one task on the master node
|
||||
internalCluster().masterClient().admin().cluster().prepareHealth().get();
|
||||
assertEquals(1, numberOfEvents(ClusterHealthAction.NAME, Tuple::v1)); // counting only registration events
|
||||
assertEquals(1, numberOfEvents(TransportClusterHealthAction.NAME, Tuple::v1)); // counting only registration events
|
||||
// counting only unregistration events
|
||||
// When checking unregistration events there might be some delay since receiving the response from the cluster doesn't
|
||||
// guarantee that the task has been unregistered.
|
||||
assertBusy(() -> assertEquals(1, numberOfEvents(ClusterHealthAction.NAME, event -> event.v1() == false)));
|
||||
assertBusy(() -> assertEquals(1, numberOfEvents(TransportClusterHealthAction.NAME, event -> event.v1() == false)));
|
||||
|
||||
resetTaskManagerListeners(ClusterHealthAction.NAME);
|
||||
resetTaskManagerListeners(TransportClusterHealthAction.NAME);
|
||||
|
||||
// Now run the health on a non-master node - should produce one task on master and one task on another node
|
||||
internalCluster().nonMasterClient().admin().cluster().prepareHealth().get();
|
||||
assertEquals(2, numberOfEvents(ClusterHealthAction.NAME, Tuple::v1)); // counting only registration events
|
||||
assertEquals(2, numberOfEvents(TransportClusterHealthAction.NAME, Tuple::v1)); // counting only registration events
|
||||
// counting only unregistration events
|
||||
assertBusy(() -> assertEquals(2, numberOfEvents(ClusterHealthAction.NAME, event -> event.v1() == false)));
|
||||
List<TaskInfo> tasks = findEvents(ClusterHealthAction.NAME, Tuple::v1);
|
||||
assertBusy(() -> assertEquals(2, numberOfEvents(TransportClusterHealthAction.NAME, event -> event.v1() == false)));
|
||||
List<TaskInfo> tasks = findEvents(TransportClusterHealthAction.NAME, Tuple::v1);
|
||||
|
||||
// Verify that one of these tasks is a parent of another task
|
||||
if (tasks.get(0).parentTaskId().isSet()) {
|
||||
|
@ -433,7 +433,7 @@ public class TasksIT extends ESIntegTestCase {
|
|||
((MockTaskManager) transportService.getTaskManager()).addListener(new MockTaskManagerListener() {
|
||||
@Override
|
||||
public void onTaskRegistered(Task task) {
|
||||
if (task.getAction().startsWith(IndexAction.NAME)) {
|
||||
if (task.getAction().startsWith(TransportIndexAction.NAME)) {
|
||||
taskRegistered.countDown();
|
||||
logger.debug("Blocking [{}] starting", task);
|
||||
try {
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.apache.logging.log4j.Level;
|
|||
import org.apache.lucene.util.BytesRef;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilities;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesFailure;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesResponse;
|
||||
|
@ -478,7 +477,7 @@ public class FieldCapabilitiesIT extends ESIntegTestCase {
|
|||
if (randomBoolean()) {
|
||||
request.indexFilter(QueryBuilders.rangeQuery("timestamp").gte("2020-01-01"));
|
||||
}
|
||||
final FieldCapabilitiesResponse response = client().execute(FieldCapabilitiesAction.INSTANCE, request).actionGet();
|
||||
final FieldCapabilitiesResponse response = client().execute(TransportFieldCapabilitiesAction.TYPE, request).actionGet();
|
||||
assertTrue(failedRequest.get());
|
||||
assertThat(response.getIndices(), arrayContainingInAnyOrder("log-index-1", "log-index-2"));
|
||||
assertThat(response.getField("field1"), aMapWithSize(2));
|
||||
|
@ -512,7 +511,7 @@ public class FieldCapabilitiesIT extends ESIntegTestCase {
|
|||
if (randomBoolean()) {
|
||||
request.indexFilter(QueryBuilders.rangeQuery("timestamp").gte("2020-01-01"));
|
||||
}
|
||||
final FieldCapabilitiesResponse response = client().execute(FieldCapabilitiesAction.INSTANCE, request).actionGet();
|
||||
final FieldCapabilitiesResponse response = client().execute(TransportFieldCapabilitiesAction.TYPE, request).actionGet();
|
||||
assertThat(response.getIndices(), arrayContainingInAnyOrder("log-index-1", "log-index-2"));
|
||||
assertThat(response.getField("field1"), aMapWithSize(2));
|
||||
assertThat(response.getField("field1"), hasKey("long"));
|
||||
|
@ -574,7 +573,7 @@ public class FieldCapabilitiesIT extends ESIntegTestCase {
|
|||
if (randomBoolean()) {
|
||||
request.indexFilter(QueryBuilders.rangeQuery("timestamp").gte("2020-01-01"));
|
||||
}
|
||||
final FieldCapabilitiesResponse response = client().execute(FieldCapabilitiesAction.INSTANCE, request).actionGet();
|
||||
final FieldCapabilitiesResponse response = client().execute(TransportFieldCapabilitiesAction.TYPE, request).actionGet();
|
||||
assertThat(response.getIndices(), arrayContainingInAnyOrder("log-index-1", "log-index-2"));
|
||||
assertThat(response.getField("field1"), aMapWithSize(2));
|
||||
assertThat(response.getField("field1"), hasKey("long"));
|
||||
|
@ -630,7 +629,7 @@ public class FieldCapabilitiesIT extends ESIntegTestCase {
|
|||
}
|
||||
};
|
||||
// Single mapping
|
||||
verifyResponse.accept(client().execute(FieldCapabilitiesAction.INSTANCE, request).actionGet());
|
||||
verifyResponse.accept(client().execute(TransportFieldCapabilitiesAction.TYPE, request).actionGet());
|
||||
|
||||
// add an extra field for some indices
|
||||
String[] indicesWithExtraField = randomSubsetOf(between(1, indices.length), indices).stream().sorted().toArray(String[]::new);
|
||||
|
@ -639,7 +638,7 @@ public class FieldCapabilitiesIT extends ESIntegTestCase {
|
|||
for (String index : indicesWithExtraField) {
|
||||
prepareIndex(index).setSource("extra_field", randomIntBetween(1, 1000)).get();
|
||||
}
|
||||
FieldCapabilitiesResponse resp = client().execute(FieldCapabilitiesAction.INSTANCE, request).actionGet();
|
||||
FieldCapabilitiesResponse resp = client().execute(TransportFieldCapabilitiesAction.TYPE, request).actionGet();
|
||||
verifyResponse.accept(resp);
|
||||
assertThat(resp.getField("extra_field"), hasKey("integer"));
|
||||
assertThat(resp.getField("extra_field").get("integer").indices(), nullValue());
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.action.admin.cluster.desirednodes.TransportDeleteDesire
|
|||
import org.elasticsearch.action.admin.cluster.desirednodes.TransportGetDesiredNodesAction;
|
||||
import org.elasticsearch.action.admin.cluster.desirednodes.TransportUpdateDesiredNodesAction;
|
||||
import org.elasticsearch.action.admin.cluster.desirednodes.UpdateDesiredNodesAction;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.migration.GetFeatureUpgradeStatusAction;
|
||||
import org.elasticsearch.action.admin.cluster.migration.PostFeatureUpgradeAction;
|
||||
|
@ -102,20 +101,16 @@ import org.elasticsearch.action.admin.cluster.storedscripts.TransportGetScriptCo
|
|||
import org.elasticsearch.action.admin.cluster.storedscripts.TransportGetScriptLanguageAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.TransportGetStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.TransportPutStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksAction;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.TransportPendingClusterTasksAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.TransportIndicesAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.TransportGetAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.analyze.AnalyzeAction;
|
||||
import org.elasticsearch.action.admin.indices.analyze.ReloadAnalyzerAction;
|
||||
import org.elasticsearch.action.admin.indices.analyze.TransportAnalyzeAction;
|
||||
import org.elasticsearch.action.admin.indices.analyze.TransportReloadAnalyzersAction;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheAction;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.TransportClearIndicesCacheAction;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.close.TransportCloseIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.close.TransportVerifyShardBeforeCloseAction;
|
||||
import org.elasticsearch.action.admin.indices.create.AutoCreateAction;
|
||||
|
@ -206,17 +201,12 @@ import org.elasticsearch.action.bulk.SimulateBulkAction;
|
|||
import org.elasticsearch.action.bulk.TransportBulkAction;
|
||||
import org.elasticsearch.action.bulk.TransportShardBulkAction;
|
||||
import org.elasticsearch.action.bulk.TransportSimulateBulkAction;
|
||||
import org.elasticsearch.action.delete.DeleteAction;
|
||||
import org.elasticsearch.action.delete.TransportDeleteAction;
|
||||
import org.elasticsearch.action.explain.TransportExplainAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.get.GetAction;
|
||||
import org.elasticsearch.action.get.MultiGetAction;
|
||||
import org.elasticsearch.action.get.TransportGetAction;
|
||||
import org.elasticsearch.action.get.TransportMultiGetAction;
|
||||
import org.elasticsearch.action.get.TransportShardMultiGetAction;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.ingest.DeletePipelineAction;
|
||||
import org.elasticsearch.action.ingest.DeletePipelineTransportAction;
|
||||
|
@ -262,7 +252,6 @@ import org.elasticsearch.action.termvectors.TransportMultiTermVectorsAction;
|
|||
import org.elasticsearch.action.termvectors.TransportShardMultiTermsVectorAction;
|
||||
import org.elasticsearch.action.termvectors.TransportTermVectorsAction;
|
||||
import org.elasticsearch.action.update.TransportUpdateAction;
|
||||
import org.elasticsearch.action.update.UpdateAction;
|
||||
import org.elasticsearch.client.internal.node.NodeClient;
|
||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodes;
|
||||
|
@ -682,13 +671,13 @@ public class ActionModule extends AbstractModule {
|
|||
actions.register(DeleteDesiredBalanceAction.INSTANCE, TransportDeleteDesiredBalanceAction.class);
|
||||
actions.register(ClusterStatsAction.INSTANCE, TransportClusterStatsAction.class);
|
||||
actions.register(ClusterStateAction.INSTANCE, TransportClusterStateAction.class);
|
||||
actions.register(ClusterHealthAction.INSTANCE, TransportClusterHealthAction.class);
|
||||
actions.register(TransportClusterHealthAction.TYPE, TransportClusterHealthAction.class);
|
||||
actions.register(ClusterUpdateSettingsAction.INSTANCE, TransportClusterUpdateSettingsAction.class);
|
||||
actions.register(ClusterGetSettingsAction.INSTANCE, TransportClusterGetSettingsAction.class);
|
||||
actions.register(ClusterRerouteAction.INSTANCE, TransportClusterRerouteAction.class);
|
||||
actions.register(ClusterSearchShardsAction.INSTANCE, TransportClusterSearchShardsAction.class);
|
||||
actions.register(ClusterFormationInfoAction.INSTANCE, ClusterFormationInfoAction.TransportAction.class);
|
||||
actions.register(PendingClusterTasksAction.INSTANCE, TransportPendingClusterTasksAction.class);
|
||||
actions.register(TransportPendingClusterTasksAction.TYPE, TransportPendingClusterTasksAction.class);
|
||||
actions.register(PutRepositoryAction.INSTANCE, TransportPutRepositoryAction.class);
|
||||
actions.register(GetRepositoriesAction.INSTANCE, TransportGetRepositoriesAction.class);
|
||||
actions.register(DeleteRepositoryAction.INSTANCE, TransportDeleteRepositoryAction.class);
|
||||
|
@ -715,17 +704,17 @@ public class ActionModule extends AbstractModule {
|
|||
actions.register(DeleteIndexAction.INSTANCE, TransportDeleteIndexAction.class);
|
||||
actions.register(GetIndexAction.INSTANCE, TransportGetIndexAction.class);
|
||||
actions.register(OpenIndexAction.INSTANCE, TransportOpenIndexAction.class);
|
||||
actions.register(CloseIndexAction.INSTANCE, TransportCloseIndexAction.class);
|
||||
actions.register(TransportCloseIndexAction.TYPE, TransportCloseIndexAction.class);
|
||||
actions.register(AddIndexBlockAction.INSTANCE, TransportAddIndexBlockAction.class);
|
||||
actions.register(GetMappingsAction.INSTANCE, TransportGetMappingsAction.class);
|
||||
actions.register(GetFieldMappingsAction.INSTANCE, TransportGetFieldMappingsAction.class);
|
||||
actions.register(TransportGetFieldMappingsIndexAction.TYPE, TransportGetFieldMappingsIndexAction.class);
|
||||
actions.register(PutMappingAction.INSTANCE, TransportPutMappingAction.class);
|
||||
actions.register(AutoPutMappingAction.INSTANCE, TransportAutoPutMappingAction.class);
|
||||
actions.register(IndicesAliasesAction.INSTANCE, TransportIndicesAliasesAction.class);
|
||||
actions.register(TransportIndicesAliasesAction.TYPE, TransportIndicesAliasesAction.class);
|
||||
actions.register(UpdateSettingsAction.INSTANCE, TransportUpdateSettingsAction.class);
|
||||
actions.register(AnalyzeAction.INSTANCE, TransportAnalyzeAction.class);
|
||||
actions.register(ReloadAnalyzerAction.INSTANCE, TransportReloadAnalyzersAction.class);
|
||||
actions.register(TransportReloadAnalyzersAction.TYPE, TransportReloadAnalyzersAction.class);
|
||||
actions.register(PutIndexTemplateAction.INSTANCE, TransportPutIndexTemplateAction.class);
|
||||
actions.register(GetIndexTemplatesAction.INSTANCE, TransportGetIndexTemplatesAction.class);
|
||||
actions.register(DeleteIndexTemplateAction.INSTANCE, TransportDeleteIndexTemplateAction.class);
|
||||
|
@ -745,14 +734,14 @@ public class ActionModule extends AbstractModule {
|
|||
actions.register(GetAliasesAction.INSTANCE, TransportGetAliasesAction.class);
|
||||
actions.register(GetSettingsAction.INSTANCE, TransportGetSettingsAction.class);
|
||||
|
||||
actions.register(IndexAction.INSTANCE, TransportIndexAction.class);
|
||||
actions.register(GetAction.INSTANCE, TransportGetAction.class);
|
||||
actions.register(TransportIndexAction.TYPE, TransportIndexAction.class);
|
||||
actions.register(TransportGetAction.TYPE, TransportGetAction.class);
|
||||
actions.register(TermVectorsAction.INSTANCE, TransportTermVectorsAction.class);
|
||||
actions.register(MultiTermVectorsAction.INSTANCE, TransportMultiTermVectorsAction.class);
|
||||
actions.register(TransportShardMultiTermsVectorAction.TYPE, TransportShardMultiTermsVectorAction.class);
|
||||
actions.register(DeleteAction.INSTANCE, TransportDeleteAction.class);
|
||||
actions.register(UpdateAction.INSTANCE, TransportUpdateAction.class);
|
||||
actions.register(MultiGetAction.INSTANCE, TransportMultiGetAction.class);
|
||||
actions.register(TransportDeleteAction.TYPE, TransportDeleteAction.class);
|
||||
actions.register(TransportUpdateAction.TYPE, TransportUpdateAction.class);
|
||||
actions.register(TransportMultiGetAction.TYPE, TransportMultiGetAction.class);
|
||||
actions.register(TransportShardMultiGetAction.TYPE, TransportShardMultiGetAction.class);
|
||||
actions.register(BulkAction.INSTANCE, TransportBulkAction.class);
|
||||
actions.register(SimulateBulkAction.INSTANCE, TransportSimulateBulkAction.class);
|
||||
|
@ -781,7 +770,7 @@ public class ActionModule extends AbstractModule {
|
|||
actions.register(GetScriptContextAction.INSTANCE, TransportGetScriptContextAction.class);
|
||||
actions.register(GetScriptLanguageAction.INSTANCE, TransportGetScriptLanguageAction.class);
|
||||
|
||||
actions.register(FieldCapabilitiesAction.INSTANCE, TransportFieldCapabilitiesAction.class);
|
||||
actions.register(TransportFieldCapabilitiesAction.TYPE, TransportFieldCapabilitiesAction.class);
|
||||
|
||||
actions.register(PutPipelineAction.INSTANCE, PutPipelineTransportAction.class);
|
||||
actions.register(GetPipelineAction.INSTANCE, GetPipelineTransportAction.class);
|
||||
|
|
|
@ -131,7 +131,7 @@ public abstract class DocWriteResponse extends ReplicationResponse implements Wr
|
|||
}
|
||||
|
||||
/**
|
||||
* Needed for deserialization of single item requests in {@link org.elasticsearch.action.index.IndexAction} and BwC
|
||||
* Needed for deserialization of single item requests in {@link org.elasticsearch.action.index.TransportIndexAction} and BwC
|
||||
* deserialization path
|
||||
*/
|
||||
protected DocWriteResponse(StreamInput in) throws IOException {
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.cluster.health;
|
||||
|
||||
import org.elasticsearch.action.ActionType;
|
||||
|
||||
public class ClusterHealthAction extends ActionType<ClusterHealthResponse> {
|
||||
|
||||
public static final ClusterHealthAction INSTANCE = new ClusterHealthAction();
|
||||
public static final String NAME = "cluster:monitor/health";
|
||||
|
||||
private ClusterHealthAction() {
|
||||
super(NAME, ClusterHealthResponse::new);
|
||||
}
|
||||
}
|
|
@ -22,7 +22,7 @@ public class ClusterHealthRequestBuilder extends MasterNodeReadOperationRequestB
|
|||
ClusterHealthRequestBuilder> {
|
||||
|
||||
public ClusterHealthRequestBuilder(ElasticsearchClient client) {
|
||||
super(client, ClusterHealthAction.INSTANCE, new ClusterHealthRequest());
|
||||
super(client, TransportClusterHealthAction.TYPE, new ClusterHealthRequest());
|
||||
}
|
||||
|
||||
public ClusterHealthRequestBuilder setIndices(String... indices) {
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.apache.logging.log4j.Level;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.ActiveShardCount;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
|
@ -47,6 +48,8 @@ import java.util.function.Predicate;
|
|||
|
||||
public class TransportClusterHealthAction extends TransportMasterNodeReadAction<ClusterHealthRequest, ClusterHealthResponse> {
|
||||
|
||||
public static final String NAME = "cluster:monitor/health";
|
||||
public static final ActionType<ClusterHealthResponse> TYPE = new ActionType<ClusterHealthResponse>(NAME, ClusterHealthResponse::new);
|
||||
private static final Logger logger = LogManager.getLogger(TransportClusterHealthAction.class);
|
||||
|
||||
private final AllocationService allocationService;
|
||||
|
@ -61,7 +64,7 @@ public class TransportClusterHealthAction extends TransportMasterNodeReadAction<
|
|||
AllocationService allocationService
|
||||
) {
|
||||
super(
|
||||
ClusterHealthAction.NAME,
|
||||
NAME,
|
||||
false,
|
||||
transportService,
|
||||
clusterService,
|
||||
|
@ -157,6 +160,7 @@ public class TransportClusterHealthAction extends TransportMasterNodeReadAction<
|
|||
} else {
|
||||
final TimeValue taskTimeout = TimeValue.timeValueMillis(Math.max(0, endTimeRelativeMillis - threadPool.relativeTimeInMillis()));
|
||||
submitUnbatchedTask(source, new ClusterStateUpdateTask(request.waitForEvents(), taskTimeout) {
|
||||
|
||||
@Override
|
||||
public ClusterState execute(ClusterState currentState) {
|
||||
return currentState;
|
||||
|
@ -207,6 +211,7 @@ public class TransportClusterHealthAction extends TransportMasterNodeReadAction<
|
|||
&& e.getCause() instanceof EsRejectedExecutionException esre
|
||||
&& esre.isExecutorShutdown();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.cluster.tasks;
|
||||
|
||||
import org.elasticsearch.action.ActionType;
|
||||
|
||||
public class PendingClusterTasksAction extends ActionType<PendingClusterTasksResponse> {
|
||||
|
||||
public static final PendingClusterTasksAction INSTANCE = new PendingClusterTasksAction();
|
||||
public static final String NAME = "cluster:monitor/task";
|
||||
|
||||
private PendingClusterTasksAction() {
|
||||
super(NAME, PendingClusterTasksResponse::new);
|
||||
}
|
||||
}
|
|
@ -17,6 +17,6 @@ public class PendingClusterTasksRequestBuilder extends MasterNodeReadOperationRe
|
|||
PendingClusterTasksRequestBuilder> {
|
||||
|
||||
public PendingClusterTasksRequestBuilder(ElasticsearchClient client) {
|
||||
super(client, PendingClusterTasksAction.INSTANCE, new PendingClusterTasksRequest());
|
||||
super(client, TransportPendingClusterTasksAction.TYPE, new PendingClusterTasksRequest());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ package org.elasticsearch.action.admin.cluster.tasks;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeReadAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
|
@ -30,6 +31,10 @@ public class TransportPendingClusterTasksAction extends TransportMasterNodeReadA
|
|||
PendingClusterTasksRequest,
|
||||
PendingClusterTasksResponse> {
|
||||
|
||||
public static final ActionType<PendingClusterTasksResponse> TYPE = new ActionType<>(
|
||||
"cluster:monitor/task",
|
||||
PendingClusterTasksResponse::new
|
||||
);
|
||||
private static final Logger logger = LogManager.getLogger(TransportPendingClusterTasksAction.class);
|
||||
|
||||
private final ClusterService clusterService;
|
||||
|
@ -43,7 +48,7 @@ public class TransportPendingClusterTasksAction extends TransportMasterNodeReadA
|
|||
IndexNameExpressionResolver indexNameExpressionResolver
|
||||
) {
|
||||
super(
|
||||
PendingClusterTasksAction.NAME,
|
||||
TYPE.name(),
|
||||
transportService,
|
||||
clusterService,
|
||||
threadPool,
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.indices.alias;
|
||||
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
||||
public class IndicesAliasesAction extends ActionType<AcknowledgedResponse> {
|
||||
|
||||
public static final IndicesAliasesAction INSTANCE = new IndicesAliasesAction();
|
||||
public static final String NAME = "indices:admin/aliases";
|
||||
|
||||
private IndicesAliasesAction() {
|
||||
super(NAME, AcknowledgedResponse::readFrom);
|
||||
}
|
||||
|
||||
}
|
|
@ -25,7 +25,7 @@ public class IndicesAliasesRequestBuilder extends AcknowledgedRequestBuilder<
|
|||
IndicesAliasesRequestBuilder> {
|
||||
|
||||
public IndicesAliasesRequestBuilder(ElasticsearchClient client) {
|
||||
super(client, IndicesAliasesAction.INSTANCE, new IndicesAliasesRequest());
|
||||
super(client, TransportIndicesAliasesAction.TYPE, new IndicesAliasesRequest());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,6 +11,7 @@ package org.elasticsearch.action.admin.indices.alias;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.RequestValidators;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
|
@ -57,6 +58,8 @@ import static java.util.Collections.unmodifiableList;
|
|||
*/
|
||||
public class TransportIndicesAliasesAction extends AcknowledgedTransportMasterNodeAction<IndicesAliasesRequest> {
|
||||
|
||||
public static final String NAME = "indices:admin/aliases";
|
||||
public static final ActionType<AcknowledgedResponse> TYPE = new ActionType<>(NAME, AcknowledgedResponse::readFrom);
|
||||
private static final Logger logger = LogManager.getLogger(TransportIndicesAliasesAction.class);
|
||||
|
||||
private final MetadataIndexAliasesService indexAliasesService;
|
||||
|
@ -75,7 +78,7 @@ public class TransportIndicesAliasesAction extends AcknowledgedTransportMasterNo
|
|||
final SystemIndices systemIndices
|
||||
) {
|
||||
super(
|
||||
IndicesAliasesAction.NAME,
|
||||
NAME,
|
||||
transportService,
|
||||
clusterService,
|
||||
threadPool,
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.indices.analyze;
|
||||
|
||||
import org.elasticsearch.action.ActionType;
|
||||
|
||||
public class ReloadAnalyzerAction extends ActionType<ReloadAnalyzersResponse> {
|
||||
|
||||
public static final ReloadAnalyzerAction INSTANCE = new ReloadAnalyzerAction();
|
||||
public static final String NAME = "indices:admin/reload_analyzers";
|
||||
|
||||
private ReloadAnalyzerAction() {
|
||||
super(NAME, ReloadAnalyzersResponse::new);
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ package org.elasticsearch.action.admin.indices.analyze;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
|
@ -50,6 +51,10 @@ public class TransportReloadAnalyzersAction extends TransportBroadcastByNodeActi
|
|||
ReloadAnalyzersResponse,
|
||||
TransportReloadAnalyzersAction.ReloadResult> {
|
||||
|
||||
public static final ActionType<ReloadAnalyzersResponse> TYPE = new ActionType<>(
|
||||
"indices:admin/reload_analyzers",
|
||||
ReloadAnalyzersResponse::new
|
||||
);
|
||||
private static final Logger logger = LogManager.getLogger(TransportReloadAnalyzersAction.class);
|
||||
private final IndicesService indicesService;
|
||||
|
||||
|
@ -62,7 +67,7 @@ public class TransportReloadAnalyzersAction extends TransportBroadcastByNodeActi
|
|||
IndexNameExpressionResolver indexNameExpressionResolver
|
||||
) {
|
||||
super(
|
||||
ReloadAnalyzerAction.NAME,
|
||||
TYPE.name(),
|
||||
clusterService,
|
||||
transportService,
|
||||
actionFilters,
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.admin.indices.close;
|
||||
|
||||
import org.elasticsearch.action.ActionType;
|
||||
|
||||
public class CloseIndexAction extends ActionType<CloseIndexResponse> {
|
||||
|
||||
public static final CloseIndexAction INSTANCE = new CloseIndexAction();
|
||||
public static final String NAME = "indices:admin/close";
|
||||
|
||||
private CloseIndexAction() {
|
||||
super(NAME, CloseIndexResponse::new);
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ import org.elasticsearch.client.internal.ElasticsearchClient;
|
|||
public class CloseIndexRequestBuilder extends AcknowledgedRequestBuilder<CloseIndexRequest, CloseIndexResponse, CloseIndexRequestBuilder> {
|
||||
|
||||
public CloseIndexRequestBuilder(ElasticsearchClient client, String... indices) {
|
||||
super(client, CloseIndexAction.INSTANCE, new CloseIndexRequest(indices));
|
||||
super(client, TransportCloseIndexAction.TYPE, new CloseIndexRequest(indices));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,6 +11,7 @@ package org.elasticsearch.action.admin.indices.close;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.DestructiveOperations;
|
||||
import org.elasticsearch.action.support.master.TransportMasterNodeAction;
|
||||
|
@ -39,6 +40,8 @@ import java.util.Collections;
|
|||
*/
|
||||
public class TransportCloseIndexAction extends TransportMasterNodeAction<CloseIndexRequest, CloseIndexResponse> {
|
||||
|
||||
public static final String NAME = "indices:admin/close";
|
||||
public static final ActionType<CloseIndexResponse> TYPE = new ActionType<>(NAME, CloseIndexResponse::new);
|
||||
private static final Logger logger = LogManager.getLogger(TransportCloseIndexAction.class);
|
||||
|
||||
private final MetadataIndexStateService indexStateService;
|
||||
|
@ -64,7 +67,7 @@ public class TransportCloseIndexAction extends TransportMasterNodeAction<CloseIn
|
|||
DestructiveOperations destructiveOperations
|
||||
) {
|
||||
super(
|
||||
CloseIndexAction.NAME,
|
||||
NAME,
|
||||
transportService,
|
||||
clusterService,
|
||||
threadPool,
|
||||
|
|
|
@ -41,7 +41,7 @@ public class TransportVerifyShardBeforeCloseAction extends TransportReplicationA
|
|||
TransportVerifyShardBeforeCloseAction.ShardRequest,
|
||||
ReplicationResponse> {
|
||||
|
||||
public static final String NAME = CloseIndexAction.NAME + "[s]";
|
||||
public static final String NAME = TransportCloseIndexAction.NAME + "[s]";
|
||||
public static final ActionType<ReplicationResponse> TYPE = new ActionType<>(NAME, ReplicationResponse::new);
|
||||
private static final Logger logger = LogManager.getLogger(TransportVerifyShardBeforeCloseAction.class);
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.delete;
|
||||
|
||||
import org.elasticsearch.action.ActionType;
|
||||
|
||||
public class DeleteAction extends ActionType<DeleteResponse> {
|
||||
|
||||
public static final DeleteAction INSTANCE = new DeleteAction();
|
||||
public static final String NAME = "indices:data/write/delete";
|
||||
|
||||
private DeleteAction() {
|
||||
super(NAME, DeleteResponse::new);
|
||||
}
|
||||
}
|
|
@ -22,7 +22,7 @@ public class DeleteRequestBuilder extends ReplicationRequestBuilder<DeleteReques
|
|||
WriteRequestBuilder<DeleteRequestBuilder> {
|
||||
|
||||
public DeleteRequestBuilder(ElasticsearchClient client, @Nullable String index) {
|
||||
super(client, DeleteAction.INSTANCE, new DeleteRequest(index));
|
||||
super(client, TransportDeleteAction.TYPE, new DeleteRequest(index));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
package org.elasticsearch.action.delete;
|
||||
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.bulk.TransportBulkAction;
|
||||
import org.elasticsearch.action.bulk.TransportSingleItemBulkWriteAction;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
|
@ -22,8 +23,11 @@ import org.elasticsearch.transport.TransportService;
|
|||
@Deprecated
|
||||
public class TransportDeleteAction extends TransportSingleItemBulkWriteAction<DeleteRequest, DeleteResponse> {
|
||||
|
||||
public static final String NAME = "indices:data/write/delete";
|
||||
public static final ActionType<DeleteResponse> TYPE = new ActionType<>(NAME, DeleteResponse::new);
|
||||
|
||||
@Inject
|
||||
public TransportDeleteAction(TransportService transportService, ActionFilters actionFilters, TransportBulkAction bulkAction) {
|
||||
super(DeleteAction.NAME, transportService, actionFilters, DeleteRequest::new, bulkAction);
|
||||
super(NAME, transportService, actionFilters, DeleteRequest::new, bulkAction);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.fieldcaps;
|
||||
|
||||
import org.elasticsearch.action.ActionType;
|
||||
|
||||
public class FieldCapabilitiesAction extends ActionType<FieldCapabilitiesResponse> {
|
||||
|
||||
public static final FieldCapabilitiesAction INSTANCE = new FieldCapabilitiesAction();
|
||||
public static final String NAME = "indices:data/read/field_caps";
|
||||
|
||||
private FieldCapabilitiesAction() {
|
||||
super(NAME, FieldCapabilitiesResponse::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -16,7 +16,7 @@ import java.util.Map;
|
|||
|
||||
public class FieldCapabilitiesRequestBuilder extends ActionRequestBuilder<FieldCapabilitiesRequest, FieldCapabilitiesResponse> {
|
||||
public FieldCapabilitiesRequestBuilder(ElasticsearchClient client, String... indices) {
|
||||
super(client, FieldCapabilitiesAction.INSTANCE, new FieldCapabilitiesRequest().indices(indices));
|
||||
super(client, TransportFieldCapabilitiesAction.TYPE, new FieldCapabilitiesRequest().indices(indices));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.apache.lucene.util.ArrayUtil;
|
|||
import org.elasticsearch.ExceptionsHelper;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionRunnable;
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.OriginalIndices;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.ChannelActionListener;
|
||||
|
@ -63,7 +64,9 @@ import java.util.stream.Collectors;
|
|||
import static org.elasticsearch.action.search.TransportSearchHelper.checkCCSVersionCompatibility;
|
||||
|
||||
public class TransportFieldCapabilitiesAction extends HandledTransportAction<FieldCapabilitiesRequest, FieldCapabilitiesResponse> {
|
||||
public static final String ACTION_NODE_NAME = FieldCapabilitiesAction.NAME + "[n]";
|
||||
public static final String NAME = "indices:data/read/field_caps";
|
||||
public static final ActionType<FieldCapabilitiesResponse> TYPE = new ActionType<>(NAME, FieldCapabilitiesResponse::new);
|
||||
public static final String ACTION_NODE_NAME = NAME + "[n]";
|
||||
public static final Logger LOGGER = LogManager.getLogger(TransportFieldCapabilitiesAction.class);
|
||||
|
||||
private final ThreadPool threadPool;
|
||||
|
@ -86,7 +89,7 @@ public class TransportFieldCapabilitiesAction extends HandledTransportAction<Fie
|
|||
) {
|
||||
// TODO replace SAME when removing workaround for https://github.com/elastic/elasticsearch/issues/97916
|
||||
super(
|
||||
FieldCapabilitiesAction.NAME,
|
||||
NAME,
|
||||
transportService,
|
||||
actionFilters,
|
||||
FieldCapabilitiesRequest::new,
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.get;
|
||||
|
||||
import org.elasticsearch.action.ActionType;
|
||||
|
||||
public class GetAction extends ActionType<GetResponse> {
|
||||
|
||||
public static final GetAction INSTANCE = new GetAction();
|
||||
public static final String NAME = "indices:data/read/get";
|
||||
|
||||
private GetAction() {
|
||||
super(NAME, GetResponse::new);
|
||||
}
|
||||
|
||||
}
|
|
@ -21,11 +21,11 @@ import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
|
|||
public class GetRequestBuilder extends SingleShardOperationRequestBuilder<GetRequest, GetResponse, GetRequestBuilder> {
|
||||
|
||||
public GetRequestBuilder(ElasticsearchClient client) {
|
||||
super(client, GetAction.INSTANCE, new GetRequest());
|
||||
super(client, TransportGetAction.TYPE, new GetRequest());
|
||||
}
|
||||
|
||||
public GetRequestBuilder(ElasticsearchClient client, @Nullable String index) {
|
||||
super(client, GetAction.INSTANCE, new GetRequest(index));
|
||||
super(client, TransportGetAction.TYPE, new GetRequest(index));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.get;
|
||||
|
||||
import org.elasticsearch.action.ActionType;
|
||||
|
||||
public class MultiGetAction extends ActionType<MultiGetResponse> {
|
||||
|
||||
public static final MultiGetAction INSTANCE = new MultiGetAction();
|
||||
public static final String NAME = "indices:data/read/mget";
|
||||
|
||||
private MultiGetAction() {
|
||||
super(NAME, MultiGetResponse::new);
|
||||
}
|
||||
}
|
|
@ -17,7 +17,7 @@ import org.elasticsearch.client.internal.ElasticsearchClient;
|
|||
public class MultiGetRequestBuilder extends ActionRequestBuilder<MultiGetRequest, MultiGetResponse> {
|
||||
|
||||
public MultiGetRequestBuilder(ElasticsearchClient client) {
|
||||
super(client, MultiGetAction.INSTANCE, new MultiGetRequest());
|
||||
super(client, TransportMultiGetAction.TYPE, new MultiGetRequest());
|
||||
}
|
||||
|
||||
public MultiGetRequestBuilder add(String index, String id) {
|
||||
|
|
|
@ -11,6 +11,7 @@ package org.elasticsearch.action.get;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionListenerResponseHandler;
|
||||
import org.elasticsearch.action.ActionRunnable;
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.NoShardAvailableActionException;
|
||||
import org.elasticsearch.action.admin.indices.refresh.TransportShardRefreshAction;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
|
@ -46,6 +47,7 @@ import java.util.concurrent.Executor;
|
|||
*/
|
||||
public class TransportGetAction extends TransportSingleShardAction<GetRequest, GetResponse> {
|
||||
|
||||
public static final ActionType<GetResponse> TYPE = new ActionType<>("indices:data/read/get", GetResponse::new);
|
||||
private static final Logger logger = LogManager.getLogger(TransportGetAction.class);
|
||||
|
||||
private final IndicesService indicesService;
|
||||
|
@ -64,7 +66,7 @@ public class TransportGetAction extends TransportSingleShardAction<GetRequest, G
|
|||
NodeClient client
|
||||
) {
|
||||
super(
|
||||
GetAction.NAME,
|
||||
TYPE.name(),
|
||||
threadPool,
|
||||
clusterService,
|
||||
transportService,
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
package org.elasticsearch.action.get;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.DelegatingActionListener;
|
||||
import org.elasticsearch.action.RoutingMissingException;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
|
@ -33,6 +34,8 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
|
||||
public class TransportMultiGetAction extends HandledTransportAction<MultiGetRequest, MultiGetResponse> {
|
||||
|
||||
public static final String NAME = "indices:data/read/mget";
|
||||
public static final ActionType<MultiGetResponse> TYPE = new ActionType<>(NAME, MultiGetResponse::new);
|
||||
private final ClusterService clusterService;
|
||||
private final NodeClient client;
|
||||
private final IndexNameExpressionResolver indexNameExpressionResolver;
|
||||
|
@ -46,7 +49,7 @@ public class TransportMultiGetAction extends HandledTransportAction<MultiGetRequ
|
|||
IndexNameExpressionResolver resolver,
|
||||
IndicesService indicesService
|
||||
) {
|
||||
super(MultiGetAction.NAME, transportService, actionFilters, MultiGetRequest::new, EsExecutors.DIRECT_EXECUTOR_SERVICE);
|
||||
super(NAME, transportService, actionFilters, MultiGetRequest::new, EsExecutors.DIRECT_EXECUTOR_SERVICE);
|
||||
this.clusterService = clusterService;
|
||||
this.client = client;
|
||||
this.indexNameExpressionResolver = resolver;
|
||||
|
|
|
@ -47,7 +47,7 @@ import static org.elasticsearch.core.Strings.format;
|
|||
|
||||
public class TransportShardMultiGetAction extends TransportSingleShardAction<MultiGetShardRequest, MultiGetShardResponse> {
|
||||
|
||||
private static final String ACTION_NAME = MultiGetAction.NAME + "[shard]";
|
||||
private static final String ACTION_NAME = TransportMultiGetAction.NAME + "[shard]";
|
||||
public static final ActionType<MultiGetShardResponse> TYPE = new ActionType<>(ACTION_NAME, MultiGetShardResponse::new);
|
||||
private static final Logger logger = LogManager.getLogger(TransportShardMultiGetAction.class);
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.index;
|
||||
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
|
||||
public class IndexAction extends ActionType<DocWriteResponse> {
|
||||
|
||||
public static final IndexAction INSTANCE = new IndexAction();
|
||||
public static final String NAME = "indices:data/write/index";
|
||||
|
||||
private IndexAction() {
|
||||
super(NAME, in -> {
|
||||
assert false : "Might not be an IndexResponse!";
|
||||
return new IndexResponse(in);
|
||||
});
|
||||
}
|
||||
}
|
|
@ -29,11 +29,11 @@ public class IndexRequestBuilder extends ReplicationRequestBuilder<IndexRequest,
|
|||
WriteRequestBuilder<IndexRequestBuilder> {
|
||||
|
||||
public IndexRequestBuilder(ElasticsearchClient client) {
|
||||
super(client, IndexAction.INSTANCE, new IndexRequest());
|
||||
super(client, TransportIndexAction.TYPE, new IndexRequest());
|
||||
}
|
||||
|
||||
public IndexRequestBuilder(ElasticsearchClient client, @Nullable String index) {
|
||||
super(client, IndexAction.INSTANCE, new IndexRequest(index));
|
||||
super(client, TransportIndexAction.TYPE, new IndexRequest(index));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
package org.elasticsearch.action.index;
|
||||
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.bulk.TransportBulkAction;
|
||||
import org.elasticsearch.action.bulk.TransportSingleItemBulkWriteAction;
|
||||
|
@ -30,8 +31,14 @@ import org.elasticsearch.transport.TransportService;
|
|||
@Deprecated
|
||||
public class TransportIndexAction extends TransportSingleItemBulkWriteAction<IndexRequest, DocWriteResponse> {
|
||||
|
||||
public static final String NAME = "indices:data/write/index";
|
||||
public static final ActionType<DocWriteResponse> TYPE = new ActionType<>(NAME, in -> {
|
||||
assert false : "Might not be an IndexResponse!";
|
||||
return new IndexResponse(in);
|
||||
});
|
||||
|
||||
@Inject
|
||||
public TransportIndexAction(ActionFilters actionFilters, TransportService transportService, TransportBulkAction bulkAction) {
|
||||
super(IndexAction.NAME, transportService, actionFilters, IndexRequest::new, bulkAction);
|
||||
super(NAME, transportService, actionFilters, IndexRequest::new, bulkAction);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ package org.elasticsearch.action.update;
|
|||
import org.elasticsearch.ResourceAlreadyExistsException;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionRunnable;
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.DocWriteRequest;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
|
@ -58,6 +59,8 @@ import static org.elasticsearch.action.bulk.TransportSingleItemBulkWriteAction.t
|
|||
|
||||
public class TransportUpdateAction extends TransportInstanceSingleOperationAction<UpdateRequest, UpdateResponse> {
|
||||
|
||||
public static final String NAME = "indices:data/write/update";
|
||||
public static final ActionType<UpdateResponse> TYPE = new ActionType<>(NAME, UpdateResponse::new);
|
||||
private final AutoCreateIndex autoCreateIndex;
|
||||
private final UpdateHelper updateHelper;
|
||||
private final IndicesService indicesService;
|
||||
|
@ -76,15 +79,7 @@ public class TransportUpdateAction extends TransportInstanceSingleOperationActio
|
|||
AutoCreateIndex autoCreateIndex,
|
||||
NodeClient client
|
||||
) {
|
||||
super(
|
||||
UpdateAction.NAME,
|
||||
threadPool,
|
||||
clusterService,
|
||||
transportService,
|
||||
actionFilters,
|
||||
indexNameExpressionResolver,
|
||||
UpdateRequest::new
|
||||
);
|
||||
super(NAME, threadPool, clusterService, transportService, actionFilters, indexNameExpressionResolver, UpdateRequest::new);
|
||||
this.updateHelper = updateHelper;
|
||||
this.indicesService = indicesService;
|
||||
this.autoCreateIndex = autoCreateIndex;
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.action.update;
|
||||
|
||||
import org.elasticsearch.action.ActionType;
|
||||
|
||||
public class UpdateAction extends ActionType<UpdateResponse> {
|
||||
|
||||
public static final UpdateAction INSTANCE = new UpdateAction();
|
||||
public static final String NAME = "indices:data/write/update";
|
||||
|
||||
private UpdateAction() {
|
||||
super(NAME, UpdateResponse::new);
|
||||
}
|
||||
}
|
|
@ -27,11 +27,11 @@ public class UpdateRequestBuilder extends InstanceShardOperationRequestBuilder<U
|
|||
WriteRequestBuilder<UpdateRequestBuilder> {
|
||||
|
||||
public UpdateRequestBuilder(ElasticsearchClient client) {
|
||||
super(client, UpdateAction.INSTANCE, new UpdateRequest());
|
||||
super(client, TransportUpdateAction.TYPE, new UpdateRequest());
|
||||
}
|
||||
|
||||
public UpdateRequestBuilder(ElasticsearchClient client, String index, String id) {
|
||||
super(client, UpdateAction.INSTANCE, new UpdateRequest(index, id));
|
||||
super(client, TransportUpdateAction.TYPE, new UpdateRequest(index, id));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,10 +20,10 @@ import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplai
|
|||
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainRequest;
|
||||
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.allocation.ClusterAllocationExplainResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsRequest;
|
||||
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.node.hotthreads.NodesHotThreadsResponse;
|
||||
|
@ -122,13 +122,13 @@ import org.elasticsearch.action.admin.cluster.storedscripts.GetStoredScriptRespo
|
|||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptAction;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequest;
|
||||
import org.elasticsearch.action.admin.cluster.storedscripts.PutStoredScriptRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksAction;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequest;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksRequestBuilder;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.PendingClusterTasksResponse;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesAction;
|
||||
import org.elasticsearch.action.admin.cluster.tasks.TransportPendingClusterTasksAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.alias.TransportIndicesAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequestBuilder;
|
||||
|
@ -139,10 +139,10 @@ import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheActio
|
|||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexResponse;
|
||||
import org.elasticsearch.action.admin.indices.close.TransportCloseIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequestBuilder;
|
||||
|
@ -242,29 +242,29 @@ import org.elasticsearch.action.bulk.BulkAction;
|
|||
import org.elasticsearch.action.bulk.BulkRequest;
|
||||
import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
||||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
import org.elasticsearch.action.delete.DeleteAction;
|
||||
import org.elasticsearch.action.delete.DeleteRequest;
|
||||
import org.elasticsearch.action.delete.DeleteRequestBuilder;
|
||||
import org.elasticsearch.action.delete.DeleteResponse;
|
||||
import org.elasticsearch.action.delete.TransportDeleteAction;
|
||||
import org.elasticsearch.action.explain.ExplainRequest;
|
||||
import org.elasticsearch.action.explain.ExplainRequestBuilder;
|
||||
import org.elasticsearch.action.explain.ExplainResponse;
|
||||
import org.elasticsearch.action.explain.TransportExplainAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequestBuilder;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesResponse;
|
||||
import org.elasticsearch.action.get.GetAction;
|
||||
import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.get.GetRequestBuilder;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.get.MultiGetAction;
|
||||
import org.elasticsearch.action.get.MultiGetRequest;
|
||||
import org.elasticsearch.action.get.MultiGetRequestBuilder;
|
||||
import org.elasticsearch.action.get.MultiGetResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.get.TransportGetAction;
|
||||
import org.elasticsearch.action.get.TransportMultiGetAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.ingest.DeletePipelineAction;
|
||||
import org.elasticsearch.action.ingest.DeletePipelineRequest;
|
||||
import org.elasticsearch.action.ingest.DeletePipelineRequestBuilder;
|
||||
|
@ -304,7 +304,7 @@ import org.elasticsearch.action.termvectors.TermVectorsAction;
|
|||
import org.elasticsearch.action.termvectors.TermVectorsRequest;
|
||||
import org.elasticsearch.action.termvectors.TermVectorsRequestBuilder;
|
||||
import org.elasticsearch.action.termvectors.TermVectorsResponse;
|
||||
import org.elasticsearch.action.update.UpdateAction;
|
||||
import org.elasticsearch.action.update.TransportUpdateAction;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
import org.elasticsearch.action.update.UpdateRequestBuilder;
|
||||
import org.elasticsearch.action.update.UpdateResponse;
|
||||
|
@ -393,12 +393,12 @@ public abstract class AbstractClient implements Client {
|
|||
|
||||
@Override
|
||||
public ActionFuture<DocWriteResponse> index(final IndexRequest request) {
|
||||
return execute(IndexAction.INSTANCE, request);
|
||||
return execute(TransportIndexAction.TYPE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void index(final IndexRequest request, final ActionListener<DocWriteResponse> listener) {
|
||||
execute(IndexAction.INSTANCE, request, listener);
|
||||
execute(TransportIndexAction.TYPE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -413,12 +413,12 @@ public abstract class AbstractClient implements Client {
|
|||
|
||||
@Override
|
||||
public ActionFuture<UpdateResponse> update(final UpdateRequest request) {
|
||||
return execute(UpdateAction.INSTANCE, request);
|
||||
return execute(TransportUpdateAction.TYPE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(final UpdateRequest request, final ActionListener<UpdateResponse> listener) {
|
||||
execute(UpdateAction.INSTANCE, request, listener);
|
||||
execute(TransportUpdateAction.TYPE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -433,12 +433,12 @@ public abstract class AbstractClient implements Client {
|
|||
|
||||
@Override
|
||||
public ActionFuture<DeleteResponse> delete(final DeleteRequest request) {
|
||||
return execute(DeleteAction.INSTANCE, request);
|
||||
return execute(TransportDeleteAction.TYPE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(final DeleteRequest request, final ActionListener<DeleteResponse> listener) {
|
||||
execute(DeleteAction.INSTANCE, request, listener);
|
||||
execute(TransportDeleteAction.TYPE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -473,12 +473,12 @@ public abstract class AbstractClient implements Client {
|
|||
|
||||
@Override
|
||||
public ActionFuture<GetResponse> get(final GetRequest request) {
|
||||
return execute(GetAction.INSTANCE, request);
|
||||
return execute(TransportGetAction.TYPE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void get(final GetRequest request, final ActionListener<GetResponse> listener) {
|
||||
execute(GetAction.INSTANCE, request, listener);
|
||||
execute(TransportGetAction.TYPE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -493,12 +493,12 @@ public abstract class AbstractClient implements Client {
|
|||
|
||||
@Override
|
||||
public ActionFuture<MultiGetResponse> multiGet(final MultiGetRequest request) {
|
||||
return execute(MultiGetAction.INSTANCE, request);
|
||||
return execute(TransportMultiGetAction.TYPE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void multiGet(final MultiGetRequest request, final ActionListener<MultiGetResponse> listener) {
|
||||
execute(MultiGetAction.INSTANCE, request, listener);
|
||||
execute(TransportMultiGetAction.TYPE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -618,12 +618,12 @@ public abstract class AbstractClient implements Client {
|
|||
|
||||
@Override
|
||||
public void fieldCaps(FieldCapabilitiesRequest request, ActionListener<FieldCapabilitiesResponse> listener) {
|
||||
execute(FieldCapabilitiesAction.INSTANCE, request, listener);
|
||||
execute(TransportFieldCapabilitiesAction.TYPE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionFuture<FieldCapabilitiesResponse> fieldCaps(FieldCapabilitiesRequest request) {
|
||||
return execute(FieldCapabilitiesAction.INSTANCE, request);
|
||||
return execute(TransportFieldCapabilitiesAction.TYPE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -684,12 +684,12 @@ public abstract class AbstractClient implements Client {
|
|||
|
||||
@Override
|
||||
public ActionFuture<ClusterHealthResponse> health(final ClusterHealthRequest request) {
|
||||
return execute(ClusterHealthAction.INSTANCE, request);
|
||||
return execute(TransportClusterHealthAction.TYPE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void health(final ClusterHealthRequest request, final ActionListener<ClusterHealthResponse> listener) {
|
||||
execute(ClusterHealthAction.INSTANCE, request, listener);
|
||||
execute(TransportClusterHealthAction.TYPE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -872,7 +872,7 @@ public abstract class AbstractClient implements Client {
|
|||
|
||||
@Override
|
||||
public void pendingClusterTasks(PendingClusterTasksRequest request, ActionListener<PendingClusterTasksResponse> listener) {
|
||||
execute(PendingClusterTasksAction.INSTANCE, request, listener);
|
||||
execute(TransportPendingClusterTasksAction.TYPE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1164,12 +1164,12 @@ public abstract class AbstractClient implements Client {
|
|||
|
||||
@Override
|
||||
public ActionFuture<AcknowledgedResponse> aliases(final IndicesAliasesRequest request) {
|
||||
return execute(IndicesAliasesAction.INSTANCE, request);
|
||||
return execute(TransportIndicesAliasesAction.TYPE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void aliases(final IndicesAliasesRequest request, final ActionListener<AcknowledgedResponse> listener) {
|
||||
execute(IndicesAliasesAction.INSTANCE, request, listener);
|
||||
execute(TransportIndicesAliasesAction.TYPE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1254,12 +1254,12 @@ public abstract class AbstractClient implements Client {
|
|||
|
||||
@Override
|
||||
public ActionFuture<CloseIndexResponse> close(final CloseIndexRequest request) {
|
||||
return execute(CloseIndexAction.INSTANCE, request);
|
||||
return execute(TransportCloseIndexAction.TYPE, request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(final CloseIndexRequest request, final ActionListener<CloseIndexResponse> listener) {
|
||||
execute(CloseIndexAction.INSTANCE, request, listener);
|
||||
execute(TransportCloseIndexAction.TYPE, request, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
|
||||
package org.elasticsearch.rest.action.admin.indices;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.analyze.ReloadAnalyzerAction;
|
||||
import org.elasticsearch.action.admin.indices.analyze.ReloadAnalyzersRequest;
|
||||
import org.elasticsearch.action.admin.indices.analyze.TransportReloadAnalyzersAction;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.internal.node.NodeClient;
|
||||
import org.elasticsearch.common.Strings;
|
||||
|
@ -43,6 +43,10 @@ public class RestReloadAnalyzersAction extends BaseRestHandler {
|
|||
Strings.splitStringByCommaToArray(request.param("index"))
|
||||
);
|
||||
reloadAnalyzersRequest.indicesOptions(IndicesOptions.fromRequest(request, reloadAnalyzersRequest.indicesOptions()));
|
||||
return channel -> client.execute(ReloadAnalyzerAction.INSTANCE, reloadAnalyzersRequest, new RestToXContentListener<>(channel));
|
||||
return channel -> client.execute(
|
||||
TransportReloadAnalyzersAction.TYPE,
|
||||
reloadAnalyzersRequest,
|
||||
new RestToXContentListener<>(channel)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
/**
|
||||
* Support for running user provided scripts (in the request, in cluster state, etc) in portions of various requests
|
||||
* ({@link org.elasticsearch.common.lucene.search.function.FunctionScoreQuery}, {@link org.elasticsearch.search.aggregations.Aggregation},
|
||||
* {@link org.elasticsearch.action.update.UpdateAction}, etc). Pluggable via implementing {@link org.elasticsearch.plugins.ScriptPlugin}.
|
||||
* {@link org.elasticsearch.action.update.TransportUpdateAction}, etc). Pluggable via implementing
|
||||
* {@link org.elasticsearch.plugins.ScriptPlugin}.
|
||||
*/
|
||||
package org.elasticsearch.script;
|
||||
|
|
|
@ -18,9 +18,9 @@ import org.elasticsearch.action.ActionListener;
|
|||
import org.elasticsearch.action.DelegatingActionListener;
|
||||
import org.elasticsearch.action.DocWriteRequest;
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.admin.indices.analyze.ReloadAnalyzerAction;
|
||||
import org.elasticsearch.action.admin.indices.analyze.ReloadAnalyzersRequest;
|
||||
import org.elasticsearch.action.admin.indices.analyze.ReloadAnalyzersResponse;
|
||||
import org.elasticsearch.action.admin.indices.analyze.TransportReloadAnalyzersAction;
|
||||
import org.elasticsearch.action.bulk.BulkItemResponse;
|
||||
import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
|
@ -468,7 +468,7 @@ public class SynonymsManagementAPIService {
|
|||
// auto-reload all reloadable analyzers (currently only those that use updateable synonym or keyword_marker filters)
|
||||
ReloadAnalyzersRequest reloadAnalyzersRequest = new ReloadAnalyzersRequest(synonymSetId, preview, "*");
|
||||
client.execute(
|
||||
ReloadAnalyzerAction.INSTANCE,
|
||||
TransportReloadAnalyzersAction.TYPE,
|
||||
reloadAnalyzersRequest,
|
||||
listener.safeMap(reloadResponse -> new SynonymsReloadResult(synonymsOperationResult, reloadResponse))
|
||||
);
|
||||
|
|
|
@ -11,9 +11,9 @@ package org.elasticsearch.action.bulk;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.DocWriteRequest;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.ActionTestUtils;
|
||||
import org.elasticsearch.action.support.AutoCreateIndex;
|
||||
|
@ -164,7 +164,7 @@ public class TransportBulkActionIngestTests extends ESTestCase {
|
|||
|
||||
TestSingleItemBulkWriteAction(TestTransportBulkAction bulkAction) {
|
||||
super(
|
||||
IndexAction.NAME,
|
||||
TransportIndexAction.NAME,
|
||||
TransportBulkActionIngestTests.this.transportService,
|
||||
new ActionFilters(Collections.emptySet()),
|
||||
IndexRequest::new,
|
||||
|
|
|
@ -257,7 +257,7 @@ public class TransportMultiGetActionTests extends ESTestCase {
|
|||
return new Task(
|
||||
randomLong(),
|
||||
"transport",
|
||||
MultiGetAction.NAME,
|
||||
TransportMultiGetAction.NAME,
|
||||
"description",
|
||||
new TaskId(randomLong() + ":" + randomLong()),
|
||||
emptyMap()
|
||||
|
|
|
@ -19,9 +19,9 @@ import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheActio
|
|||
import org.elasticsearch.action.admin.indices.create.CreateIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.flush.FlushAction;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsAction;
|
||||
import org.elasticsearch.action.delete.DeleteAction;
|
||||
import org.elasticsearch.action.get.GetAction;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.delete.TransportDeleteAction;
|
||||
import org.elasticsearch.action.get.TransportGetAction;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.search.TransportSearchAction;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.concurrent.ThreadContext;
|
||||
|
@ -47,11 +47,11 @@ public abstract class AbstractClientHeadersTestCase extends ESTestCase {
|
|||
|
||||
private static final ActionType<?>[] ACTIONS = new ActionType<?>[] {
|
||||
// client actions
|
||||
GetAction.INSTANCE,
|
||||
TransportGetAction.TYPE,
|
||||
TransportSearchAction.TYPE,
|
||||
DeleteAction.INSTANCE,
|
||||
TransportDeleteAction.TYPE,
|
||||
DeleteStoredScriptAction.INSTANCE,
|
||||
IndexAction.INSTANCE,
|
||||
TransportIndexAction.TYPE,
|
||||
|
||||
// cluster admin actions
|
||||
ClusterStatsAction.INSTANCE,
|
||||
|
@ -96,9 +96,9 @@ public abstract class AbstractClientHeadersTestCase extends ESTestCase {
|
|||
// validation in the settings??? - ugly and conceptually wrong)
|
||||
|
||||
// choosing arbitrary top level actions to test
|
||||
client.prepareGet("idx", "id").execute(new AssertingActionListener<>(GetAction.NAME, client.threadPool()));
|
||||
client.prepareGet("idx", "id").execute(new AssertingActionListener<>(TransportGetAction.TYPE.name(), client.threadPool()));
|
||||
client.prepareSearch().execute(new AssertingActionListener<>(TransportSearchAction.TYPE.name(), client.threadPool()));
|
||||
client.prepareDelete("idx", "id").execute(new AssertingActionListener<>(DeleteAction.NAME, client.threadPool()));
|
||||
client.prepareDelete("idx", "id").execute(new AssertingActionListener<>(TransportDeleteAction.NAME, client.threadPool()));
|
||||
client.admin()
|
||||
.cluster()
|
||||
.prepareDeleteStoredScript("id")
|
||||
|
@ -106,7 +106,7 @@ public abstract class AbstractClientHeadersTestCase extends ESTestCase {
|
|||
client.prepareIndex("idx")
|
||||
.setId("id")
|
||||
.setSource("source", XContentType.JSON)
|
||||
.execute(new AssertingActionListener<>(IndexAction.NAME, client.threadPool()));
|
||||
.execute(new AssertingActionListener<>(TransportIndexAction.NAME, client.threadPool()));
|
||||
|
||||
// choosing arbitrary cluster admin actions to test
|
||||
client.admin().cluster().prepareClusterStats().execute(new AssertingActionListener<>(ClusterStatsAction.NAME, client.threadPool()));
|
||||
|
@ -132,7 +132,8 @@ public abstract class AbstractClientHeadersTestCase extends ESTestCase {
|
|||
expected.put("key1", key1Val);
|
||||
expected.put("key2", "val 2");
|
||||
client.threadPool().getThreadContext().putHeader("key1", key1Val);
|
||||
client.prepareGet("idx", "id").execute(new AssertingActionListener<>(GetAction.NAME, expected, client.threadPool()));
|
||||
client.prepareGet("idx", "id")
|
||||
.execute(new AssertingActionListener<>(TransportGetAction.TYPE.name(), expected, client.threadPool()));
|
||||
|
||||
client.admin()
|
||||
.cluster()
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
package org.elasticsearch.cluster.health;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
|
||||
|
@ -159,7 +158,7 @@ public class ClusterStateHealthTests extends ESTestCase {
|
|||
PlainActionFuture<ClusterHealthResponse> listener = new PlainActionFuture<>();
|
||||
ActionTestUtils.execute(
|
||||
action,
|
||||
new CancellableTask(1, "direct", ClusterHealthAction.NAME, "", TaskId.EMPTY_TASK_ID, Map.of()),
|
||||
new CancellableTask(1, "direct", TransportClusterHealthAction.NAME, "", TaskId.EMPTY_TASK_ID, Map.of()),
|
||||
new ClusterHealthRequest().waitForGreenStatus(),
|
||||
listener
|
||||
);
|
||||
|
|
|
@ -8,9 +8,9 @@
|
|||
|
||||
package org.elasticsearch.test.disruption;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
|
||||
import org.elasticsearch.cluster.NodeConnectionsService;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -162,30 +162,35 @@ public class NetworkDisruptionIT extends ESIntegTestCase {
|
|||
}
|
||||
|
||||
private static void sendRequest(TransportService source, TransportService target, CountDownLatch latch) {
|
||||
source.sendRequest(target.getLocalNode(), ClusterHealthAction.NAME, new ClusterHealthRequest(), new TransportResponseHandler<>() {
|
||||
private AtomicBoolean responded = new AtomicBoolean();
|
||||
source.sendRequest(
|
||||
target.getLocalNode(),
|
||||
TransportClusterHealthAction.NAME,
|
||||
new ClusterHealthRequest(),
|
||||
new TransportResponseHandler<>() {
|
||||
private AtomicBoolean responded = new AtomicBoolean();
|
||||
|
||||
@Override
|
||||
public Executor executor(ThreadPool threadPool) {
|
||||
return TransportResponseHandler.TRANSPORT_WORKER;
|
||||
}
|
||||
@Override
|
||||
public Executor executor(ThreadPool threadPool) {
|
||||
return TransportResponseHandler.TRANSPORT_WORKER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleResponse(TransportResponse response) {
|
||||
assertTrue(responded.compareAndSet(false, true));
|
||||
latch.countDown();
|
||||
}
|
||||
@Override
|
||||
public void handleResponse(TransportResponse response) {
|
||||
assertTrue(responded.compareAndSet(false, true));
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleException(TransportException exp) {
|
||||
assertTrue(responded.compareAndSet(false, true));
|
||||
latch.countDown();
|
||||
}
|
||||
@Override
|
||||
public void handleException(TransportException exp) {
|
||||
assertTrue(responded.compareAndSet(false, true));
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TransportResponse read(StreamInput in) throws IOException {
|
||||
return ClusterHealthResponse.readResponseFrom(in);
|
||||
@Override
|
||||
public TransportResponse read(StreamInput in) throws IOException {
|
||||
return ClusterHealthResponse.readResponseFrom(in);
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import org.apache.logging.log4j.LogManager;
|
|||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.ResourceAlreadyExistsException;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
|
||||
import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequestBuilder;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
||||
|
@ -77,7 +77,7 @@ public class AnnotationIndex {
|
|||
executeAsyncWithOrigin(
|
||||
client,
|
||||
ML_ORIGIN,
|
||||
ClusterHealthAction.INSTANCE,
|
||||
TransportClusterHealthAction.TYPE,
|
||||
request,
|
||||
delegate.delegateFailureAndWrap((l, r) -> l.onResponse(r.isTimedOut() == false))
|
||||
);
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
package org.elasticsearch.xpack.core.ml.job.persistence;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
|
||||
import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
|
||||
|
@ -109,7 +109,7 @@ public final class AnomalyDetectorsIndex {
|
|||
executeAsyncWithOrigin(
|
||||
client,
|
||||
ML_ORIGIN,
|
||||
ClusterHealthAction.INSTANCE,
|
||||
TransportClusterHealthAction.TYPE,
|
||||
request,
|
||||
delegate.delegateFailureAndWrap((l, r) -> l.onResponse(r.isTimedOut() == false))
|
||||
);
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.apache.logging.log4j.Logger;
|
|||
import org.apache.lucene.util.automaton.Automaton;
|
||||
import org.elasticsearch.action.admin.cluster.shards.ClusterSearchShardsAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.close.CloseIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.close.TransportCloseIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.create.AutoCreateAction;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexAction;
|
||||
|
@ -28,7 +28,7 @@ import org.elasticsearch.action.datastreams.CreateDataStreamAction;
|
|||
import org.elasticsearch.action.datastreams.DeleteDataStreamAction;
|
||||
import org.elasticsearch.action.datastreams.GetDataStreamAction;
|
||||
import org.elasticsearch.action.datastreams.PromoteDataStreamAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.search.TransportSearchShardsAction;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.index.seqno.RetentionLeaseActions;
|
||||
|
@ -104,7 +104,7 @@ public final class IndexPrivilege extends Privilege {
|
|||
private static final Automaton MANAGE_AUTOMATON = unionAndMinimize(
|
||||
Arrays.asList(
|
||||
MONITOR_AUTOMATON,
|
||||
patterns("indices:admin/*", FieldCapabilitiesAction.NAME + "*", GetRollupIndexCapsAction.NAME + "*")
|
||||
patterns("indices:admin/*", TransportFieldCapabilitiesAction.NAME + "*", GetRollupIndexCapsAction.NAME + "*")
|
||||
)
|
||||
);
|
||||
private static final Automaton CREATE_INDEX_AUTOMATON = patterns(
|
||||
|
@ -127,14 +127,14 @@ public final class IndexPrivilege extends Privilege {
|
|||
"indices:admin/data_stream/lifecycle/explain",
|
||||
GetDataStreamAction.NAME,
|
||||
ResolveIndexAction.NAME,
|
||||
FieldCapabilitiesAction.NAME + "*",
|
||||
TransportFieldCapabilitiesAction.NAME + "*",
|
||||
GetRollupIndexCapsAction.NAME + "*",
|
||||
GetCheckpointAction.NAME + "*" // transform internal action
|
||||
);
|
||||
private static final Automaton MANAGE_FOLLOW_INDEX_AUTOMATON = patterns(
|
||||
PutFollowAction.NAME,
|
||||
UnfollowAction.NAME,
|
||||
CloseIndexAction.NAME + "*",
|
||||
TransportCloseIndexAction.NAME + "*",
|
||||
PromoteDataStreamAction.NAME,
|
||||
RolloverAction.NAME
|
||||
);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
package org.elasticsearch.xpack.core.security.authz.store;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.TransportIndicesAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.delete.DeleteIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction;
|
||||
import org.elasticsearch.action.admin.indices.rollover.RolloverAction;
|
||||
|
@ -298,7 +298,14 @@ class KibanaOwnedReservedRoleDescriptors {
|
|||
".metrics-endpoint.metadata_current_default*",
|
||||
".metrics-endpoint.metadata_united_default*"
|
||||
)
|
||||
.privileges("create_index", "delete_index", "read", "index", IndicesAliasesAction.NAME, UpdateSettingsAction.NAME)
|
||||
.privileges(
|
||||
"create_index",
|
||||
"delete_index",
|
||||
"read",
|
||||
"index",
|
||||
TransportIndicesAliasesAction.NAME,
|
||||
UpdateSettingsAction.NAME
|
||||
)
|
||||
.build(),
|
||||
// For destination indices of the Threat Intel (ti_*) packages that ships a transform for supporting IOC expiration
|
||||
RoleDescriptor.IndicesPrivileges.builder()
|
||||
|
@ -310,7 +317,7 @@ class KibanaOwnedReservedRoleDescriptors {
|
|||
"index",
|
||||
"delete",
|
||||
"manage",
|
||||
IndicesAliasesAction.NAME,
|
||||
TransportIndicesAliasesAction.NAME,
|
||||
UpdateSettingsAction.NAME
|
||||
)
|
||||
.build(),
|
||||
|
@ -334,7 +341,7 @@ class KibanaOwnedReservedRoleDescriptors {
|
|||
"read",
|
||||
"index",
|
||||
"view_index_metadata",
|
||||
IndicesAliasesAction.NAME,
|
||||
TransportIndicesAliasesAction.NAME,
|
||||
UpdateSettingsAction.NAME
|
||||
)
|
||||
.build(),
|
||||
|
@ -349,7 +356,7 @@ class KibanaOwnedReservedRoleDescriptors {
|
|||
"logs-cloud_security_posture.scores-default*",
|
||||
"logs-cloud_security_posture.vulnerabilities_latest-default*"
|
||||
)
|
||||
.privileges("create_index", "read", "index", "delete", IndicesAliasesAction.NAME, UpdateSettingsAction.NAME)
|
||||
.privileges("create_index", "read", "index", "delete", TransportIndicesAliasesAction.NAME, UpdateSettingsAction.NAME)
|
||||
.build(),
|
||||
RoleDescriptor.IndicesPrivileges.builder().indices("risk-score.risk-*").privileges("all").build(),
|
||||
RoleDescriptor.IndicesPrivileges.builder()
|
||||
|
|
|
@ -9,7 +9,7 @@ package org.elasticsearch.xpack.core.security.authz.store;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.remote.TransportRemoteInfoAction;
|
||||
import org.elasticsearch.action.admin.cluster.repositories.get.GetRepositoriesAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.TransportIndicesAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.rollover.RolloverAction;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.settings.Setting;
|
||||
|
@ -212,7 +212,13 @@ public class ReservedRolesStore implements BiConsumer<Set<String>, ActionListene
|
|||
RoleDescriptor.IndicesPrivileges.builder().indices(".monitoring-*").privileges("all").build(),
|
||||
RoleDescriptor.IndicesPrivileges.builder()
|
||||
.indices("metricbeat-*")
|
||||
.privileges("index", "create_index", "view_index_metadata", IndicesAliasesAction.NAME, RolloverAction.NAME)
|
||||
.privileges(
|
||||
"index",
|
||||
"create_index",
|
||||
"view_index_metadata",
|
||||
TransportIndicesAliasesAction.NAME,
|
||||
RolloverAction.NAME
|
||||
)
|
||||
.build() },
|
||||
null,
|
||||
MetadataUtils.DEFAULT_RESERVED_METADATA
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
package org.elasticsearch.xpack.core.security.user;
|
||||
|
||||
import org.elasticsearch.action.admin.indices.analyze.ReloadAnalyzerAction;
|
||||
import org.elasticsearch.action.admin.indices.analyze.TransportReloadAnalyzersAction;
|
||||
import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeAction;
|
||||
import org.elasticsearch.action.admin.indices.readonly.AddIndexBlockAction;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshAction;
|
||||
|
@ -189,7 +189,7 @@ public class InternalUsers {
|
|||
null,
|
||||
new RoleDescriptor.IndicesPrivileges[] {
|
||||
RoleDescriptor.IndicesPrivileges.builder().indices(".synonyms*").privileges("all").allowRestrictedIndices(true).build(),
|
||||
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges(ReloadAnalyzerAction.NAME).build(), },
|
||||
RoleDescriptor.IndicesPrivileges.builder().indices("*").privileges(TransportReloadAnalyzersAction.TYPE.name()).build(), },
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
|
|
|
@ -9,9 +9,9 @@ package org.elasticsearch.xpack.core;
|
|||
import org.elasticsearch.TransportVersion;
|
||||
import org.elasticsearch.TransportVersions;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.search.ShardSearchFailure;
|
||||
|
@ -110,7 +110,7 @@ public class ClientHelperTests extends ESTestCase {
|
|||
}).when(client).execute(any(), any(), any());
|
||||
|
||||
threadContext.putHeader(headerName, headerValue);
|
||||
ClientHelper.executeAsyncWithOrigin(client, origin, ClusterHealthAction.INSTANCE, new ClusterHealthRequest(), listener);
|
||||
ClientHelper.executeAsyncWithOrigin(client, origin, TransportClusterHealthAction.TYPE, new ClusterHealthRequest(), listener);
|
||||
|
||||
latch.await();
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ import org.elasticsearch.action.ActionListener;
|
|||
import org.elasticsearch.action.admin.indices.template.put.PutComposableIndexTemplateAction;
|
||||
import org.elasticsearch.action.bulk.BulkAction;
|
||||
import org.elasticsearch.action.bulk.BulkRequest;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.internal.AdminClient;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
|
@ -98,7 +98,7 @@ public class AbstractAuditorTests extends ESTestCase {
|
|||
AbstractAuditor<AbstractAuditMessageTests.TestAuditMessage> auditor = createTestAuditorWithTemplateInstalled();
|
||||
auditor.info("foo", "Here is my info");
|
||||
|
||||
verify(client).execute(eq(IndexAction.INSTANCE), indexRequestCaptor.capture(), any());
|
||||
verify(client).execute(eq(TransportIndexAction.TYPE), indexRequestCaptor.capture(), any());
|
||||
IndexRequest indexRequest = indexRequestCaptor.getValue();
|
||||
assertThat(indexRequest.indices(), arrayContaining(TEST_INDEX));
|
||||
assertThat(indexRequest.timeout(), equalTo(TimeValue.timeValueSeconds(5)));
|
||||
|
@ -117,7 +117,7 @@ public class AbstractAuditorTests extends ESTestCase {
|
|||
AbstractAuditor<AbstractAuditMessageTests.TestAuditMessage> auditor = createTestAuditorWithTemplateInstalled();
|
||||
auditor.warning("bar", "Here is my warning");
|
||||
|
||||
verify(client).execute(eq(IndexAction.INSTANCE), indexRequestCaptor.capture(), any());
|
||||
verify(client).execute(eq(TransportIndexAction.TYPE), indexRequestCaptor.capture(), any());
|
||||
IndexRequest indexRequest = indexRequestCaptor.getValue();
|
||||
assertThat(indexRequest.indices(), arrayContaining(TEST_INDEX));
|
||||
assertThat(indexRequest.timeout(), equalTo(TimeValue.timeValueSeconds(5)));
|
||||
|
@ -136,7 +136,7 @@ public class AbstractAuditorTests extends ESTestCase {
|
|||
AbstractAuditor<AbstractAuditMessageTests.TestAuditMessage> auditor = createTestAuditorWithTemplateInstalled();
|
||||
auditor.error("foobar", "Here is my error");
|
||||
|
||||
verify(client).execute(eq(IndexAction.INSTANCE), indexRequestCaptor.capture(), any());
|
||||
verify(client).execute(eq(TransportIndexAction.TYPE), indexRequestCaptor.capture(), any());
|
||||
IndexRequest indexRequest = indexRequestCaptor.getValue();
|
||||
assertThat(indexRequest.indices(), arrayContaining(TEST_INDEX));
|
||||
assertThat(indexRequest.timeout(), equalTo(TimeValue.timeValueSeconds(5)));
|
||||
|
@ -157,7 +157,7 @@ public class AbstractAuditorTests extends ESTestCase {
|
|||
AbstractAuditor<AbstractAuditMessageTests.TestAuditMessage> auditor = createTestAuditorWithTemplateInstalled();
|
||||
auditor.audit(level, "r_id", "Here is my audit");
|
||||
|
||||
verify(client).execute(eq(IndexAction.INSTANCE), indexRequestCaptor.capture(), any());
|
||||
verify(client).execute(eq(TransportIndexAction.TYPE), indexRequestCaptor.capture(), any());
|
||||
IndexRequest indexRequest = indexRequestCaptor.getValue();
|
||||
assertThat(indexRequest.indices(), arrayContaining(TEST_INDEX));
|
||||
assertThat(indexRequest.timeout(), equalTo(TimeValue.timeValueSeconds(5)));
|
||||
|
@ -182,7 +182,7 @@ public class AbstractAuditorTests extends ESTestCase {
|
|||
auditor.warning("foobar", "Here is my warning to queue");
|
||||
auditor.info("foobar", "Here is my info to queue");
|
||||
|
||||
verify(client, never()).execute(eq(IndexAction.INSTANCE), any(), any());
|
||||
verify(client, never()).execute(eq(TransportIndexAction.TYPE), any(), any());
|
||||
// fire the put template response
|
||||
writeSomeDocsBeforeTemplateLatch.countDown();
|
||||
|
||||
|
@ -194,7 +194,7 @@ public class AbstractAuditorTests extends ESTestCase {
|
|||
assertThat(bulkRequest.numberOfActions(), equalTo(3));
|
||||
|
||||
auditor.info("foobar", "Here is another message");
|
||||
verify(client, times(1)).execute(eq(IndexAction.INSTANCE), any(), any());
|
||||
verify(client, times(1)).execute(eq(TransportIndexAction.TYPE), any(), any());
|
||||
}
|
||||
|
||||
public void testMaxBufferSize() throws Exception {
|
||||
|
|
|
@ -10,9 +10,9 @@ import org.elasticsearch.action.ActionListener;
|
|||
import org.elasticsearch.action.ActionRequest;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions;
|
||||
import org.elasticsearch.action.admin.indices.alias.TransportIndicesAliasesAction;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
import org.elasticsearch.cluster.metadata.AliasMetadata;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
|
@ -134,7 +134,7 @@ public class SwapAliasesAndDeleteSourceIndexStepTests extends AbstractStepTestCa
|
|||
Request request,
|
||||
ActionListener<Response> listener
|
||||
) {
|
||||
assertThat(action.name(), is(IndicesAliasesAction.NAME));
|
||||
assertThat(action.name(), is(TransportIndicesAliasesAction.NAME));
|
||||
assertTrue(request instanceof IndicesAliasesRequest);
|
||||
assertThat(((IndicesAliasesRequest) request).getAliasActions(), equalTo(expectedAliasActions));
|
||||
}
|
||||
|
|
|
@ -11,10 +11,10 @@ import org.apache.lucene.util.automaton.Operations;
|
|||
import org.elasticsearch.action.admin.indices.refresh.RefreshAction;
|
||||
import org.elasticsearch.action.admin.indices.shrink.ShrinkAction;
|
||||
import org.elasticsearch.action.admin.indices.stats.IndicesStatsAction;
|
||||
import org.elasticsearch.action.delete.DeleteAction;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.delete.TransportDeleteAction;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.search.TransportSearchAction;
|
||||
import org.elasticsearch.action.update.UpdateAction;
|
||||
import org.elasticsearch.action.update.TransportUpdateAction;
|
||||
import org.elasticsearch.common.util.iterable.Iterables;
|
||||
import org.elasticsearch.test.ESTestCase;
|
||||
import org.elasticsearch.xpack.core.rollup.action.GetRollupIndexCapsAction;
|
||||
|
@ -60,9 +60,9 @@ public class IndexPrivilegeTests extends ESTestCase {
|
|||
|
||||
public void testFindPrivilegesThatGrant() {
|
||||
assertThat(findPrivilegesThatGrant(TransportSearchAction.TYPE.name()), equalTo(List.of("read", "all")));
|
||||
assertThat(findPrivilegesThatGrant(IndexAction.NAME), equalTo(List.of("create_doc", "create", "index", "write", "all")));
|
||||
assertThat(findPrivilegesThatGrant(UpdateAction.NAME), equalTo(List.of("index", "write", "all")));
|
||||
assertThat(findPrivilegesThatGrant(DeleteAction.NAME), equalTo(List.of("delete", "write", "all")));
|
||||
assertThat(findPrivilegesThatGrant(TransportIndexAction.NAME), equalTo(List.of("create_doc", "create", "index", "write", "all")));
|
||||
assertThat(findPrivilegesThatGrant(TransportUpdateAction.NAME), equalTo(List.of("index", "write", "all")));
|
||||
assertThat(findPrivilegesThatGrant(TransportDeleteAction.NAME), equalTo(List.of("delete", "write", "all")));
|
||||
assertThat(
|
||||
findPrivilegesThatGrant(IndicesStatsAction.NAME),
|
||||
equalTo(List.of("monitor", "cross_cluster_replication", "manage", "all"))
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
package org.elasticsearch.xpack.core.security.authz.privilege;
|
||||
|
||||
import org.apache.lucene.util.automaton.Operations;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksAction;
|
||||
import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteAction;
|
||||
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsAction;
|
||||
|
@ -301,7 +301,7 @@ public class PrivilegeTests extends ESTestCase {
|
|||
CreateServiceAccountTokenAction.NAME,
|
||||
CreateApiKeyAction.NAME,
|
||||
InvalidateApiKeyAction.NAME,
|
||||
ClusterHealthAction.NAME,
|
||||
TransportClusterHealthAction.NAME,
|
||||
ClusterStateAction.NAME,
|
||||
ClusterStatsAction.NAME,
|
||||
NodeEnrollmentAction.NAME,
|
||||
|
@ -353,7 +353,7 @@ public class PrivilegeTests extends ESTestCase {
|
|||
);
|
||||
verifyClusterActionDenied(
|
||||
ClusterPrivilegeResolver.MANAGE_USER_PROFILE,
|
||||
ClusterHealthAction.NAME,
|
||||
TransportClusterHealthAction.NAME,
|
||||
ClusterStateAction.NAME,
|
||||
ClusterStatsAction.NAME,
|
||||
PutIndexTemplateAction.NAME,
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,7 +27,7 @@ import org.elasticsearch.action.admin.indices.stats.IndicesStatsAction;
|
|||
import org.elasticsearch.action.admin.indices.template.put.PutComponentTemplateAction;
|
||||
import org.elasticsearch.action.bulk.BulkAction;
|
||||
import org.elasticsearch.action.downsample.DownsampleAction;
|
||||
import org.elasticsearch.action.get.GetAction;
|
||||
import org.elasticsearch.action.get.TransportGetAction;
|
||||
import org.elasticsearch.cluster.metadata.DataStream;
|
||||
import org.elasticsearch.cluster.metadata.IndexAbstraction;
|
||||
import org.elasticsearch.cluster.metadata.IndexMetadata;
|
||||
|
@ -87,7 +87,7 @@ public class InternalUsersTests extends ESTestCase {
|
|||
checkClusterAccess(InternalUsers.XPACK_USER, role, randomFrom(sampleClusterActions), true);
|
||||
|
||||
final List<String> sampleIndexActions = List.of(
|
||||
GetAction.NAME,
|
||||
TransportGetAction.TYPE.name(),
|
||||
BulkAction.NAME,
|
||||
RefreshAction.NAME,
|
||||
CreateIndexAction.NAME,
|
||||
|
@ -122,7 +122,7 @@ public class InternalUsersTests extends ESTestCase {
|
|||
checkClusterAccess(InternalUsers.XPACK_SECURITY_USER, role, randomFrom(sampleClusterActions), true);
|
||||
|
||||
final List<String> sampleIndexActions = List.of(
|
||||
GetAction.NAME,
|
||||
TransportGetAction.TYPE.name(),
|
||||
BulkAction.NAME,
|
||||
RefreshAction.NAME,
|
||||
CreateIndexAction.NAME,
|
||||
|
@ -149,7 +149,7 @@ public class InternalUsersTests extends ESTestCase {
|
|||
assertThat(role.remoteIndices(), is(RemoteIndicesPermission.NONE));
|
||||
|
||||
final List<String> sampleAllowedActions = List.of(
|
||||
GetAction.NAME,
|
||||
TransportGetAction.TYPE.name(),
|
||||
BulkAction.NAME,
|
||||
RefreshAction.NAME,
|
||||
CreateIndexAction.NAME,
|
||||
|
@ -180,7 +180,7 @@ public class InternalUsersTests extends ESTestCase {
|
|||
checkClusterAccess(InternalUsers.ASYNC_SEARCH_USER, role, ClusterStateAction.NAME, false);
|
||||
|
||||
final List<String> sampleAllowedActions = List.of(
|
||||
GetAction.NAME,
|
||||
TransportGetAction.TYPE.name(),
|
||||
BulkAction.NAME,
|
||||
RefreshAction.NAME,
|
||||
CreateIndexAction.NAME,
|
||||
|
@ -212,7 +212,12 @@ public class InternalUsersTests extends ESTestCase {
|
|||
checkIndexAccess(role, randomFrom(sampleAllowedActions), ".ds-" + randomAlphaOfLengthBetween(4, 8), true);
|
||||
checkIndexAccess(role, randomFrom(sampleAllowedActions), INTERNAL_SECURITY_MAIN_INDEX_7, true);
|
||||
|
||||
final List<String> sampleDeniedActions = List.of(GetAction.NAME, BulkAction.NAME, PutMappingAction.NAME, DeleteIndexAction.NAME);
|
||||
final List<String> sampleDeniedActions = List.of(
|
||||
TransportGetAction.TYPE.name(),
|
||||
BulkAction.NAME,
|
||||
PutMappingAction.NAME,
|
||||
DeleteIndexAction.NAME
|
||||
);
|
||||
checkIndexAccess(role, randomFrom(sampleDeniedActions), randomAlphaOfLengthBetween(4, 8), false);
|
||||
checkIndexAccess(role, randomFrom(sampleDeniedActions), ".ds-" + randomAlphaOfLengthBetween(4, 8), false);
|
||||
checkIndexAccess(role, randomFrom(sampleDeniedActions), INTERNAL_SECURITY_MAIN_INDEX_7, false);
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.elasticsearch.action.ActionResponse;
|
|||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.LatchedActionListener;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexAction;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexRequest;
|
||||
import org.elasticsearch.action.admin.indices.create.CreateIndexResponse;
|
||||
|
@ -2071,7 +2071,7 @@ public class EnrichPolicyRunnerTests extends ESSingleNodeTestCase {
|
|||
RefreshAction.INSTANCE,
|
||||
IndicesSegmentsAction.INSTANCE,
|
||||
UpdateSettingsAction.INSTANCE,
|
||||
ClusterHealthAction.INSTANCE
|
||||
TransportClusterHealthAction.TYPE
|
||||
);
|
||||
logger.info("Selected [{}] to perform cancel", randomActionType.name());
|
||||
Client client = new FilterClient(client()) {
|
||||
|
|
|
@ -11,9 +11,9 @@ import org.apache.lucene.search.DisjunctionMaxQuery;
|
|||
import org.apache.lucene.search.Query;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.get.GetAction;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.get.TransportGetAction;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
import org.elasticsearch.client.internal.ElasticsearchClient;
|
||||
import org.elasticsearch.common.ParsingException;
|
||||
|
@ -131,7 +131,7 @@ public class RuleQueryBuilderTests extends AbstractQueryTestCase<RuleQueryBuilde
|
|||
// Get request, to pull the query ruleset from the system index using clientWithOrigin
|
||||
if (method.getDeclaringClass().equals(ElasticsearchClient.class)
|
||||
&& method.getName().equals("execute")
|
||||
&& args[0] instanceof GetAction) {
|
||||
&& args[0] == TransportGetAction.TYPE) {
|
||||
|
||||
GetRequest getRequest = (GetRequest) args[1];
|
||||
assertThat(getRequest.index(), Matchers.equalTo(QueryRulesIndexService.QUERY_RULES_ALIAS_NAME));
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.elasticsearch.action.ActionRequest;
|
|||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.cancel.CancelTasksResponse;
|
||||
import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.support.ActionFilter;
|
||||
import org.elasticsearch.action.support.ActionFilterChain;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -195,7 +195,7 @@ public abstract class AbstractEqlBlockingIntegTestCase extends AbstractEqlIntegT
|
|||
ActionFilterChain<Request, Response> chain
|
||||
) {
|
||||
|
||||
if (action.equals(FieldCapabilitiesAction.NAME)) {
|
||||
if (action.equals(TransportFieldCapabilitiesAction.NAME)) {
|
||||
final Consumer<Response> actionWrapper = resp -> {
|
||||
try {
|
||||
fieldCaps.incrementAndGet();
|
||||
|
|
|
@ -14,7 +14,7 @@ import org.elasticsearch.action.bulk.BulkResponse;
|
|||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
import org.elasticsearch.action.update.UpdateAction;
|
||||
import org.elasticsearch.action.update.TransportUpdateAction;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.core.TimeValue;
|
||||
|
@ -233,7 +233,7 @@ public class DeleteExpiredDataIT extends MlNativeAutodetectIntegTestCase {
|
|||
String snapshotUpdate = "{ \"timestamp\": " + oneDayAgo + "}";
|
||||
UpdateRequest updateSnapshotRequest = new UpdateRequest(".ml-anomalies-" + job.getId(), snapshotDocId);
|
||||
updateSnapshotRequest.doc(snapshotUpdate.getBytes(StandardCharsets.UTF_8), XContentType.JSON);
|
||||
client().execute(UpdateAction.INSTANCE, updateSnapshotRequest).get();
|
||||
client().execute(TransportUpdateAction.TYPE, updateSnapshotRequest).get();
|
||||
|
||||
// Now let's create some forecasts
|
||||
openJob(job.getId());
|
||||
|
|
|
@ -11,8 +11,8 @@ import org.elasticsearch.action.DocWriteResponse;
|
|||
import org.elasticsearch.action.bulk.BulkAction;
|
||||
import org.elasticsearch.action.bulk.BulkRequest;
|
||||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.TransportSearchAction;
|
||||
import org.elasticsearch.action.support.PlainActionFuture;
|
||||
|
@ -239,7 +239,7 @@ public class ModelSnapshotRetentionIT extends MlNativeAutodetectIntegTestCase {
|
|||
modelSnapshotBuilder.build().toXContent(xContentBuilder, ToXContent.EMPTY_PARAMS);
|
||||
indexRequest.source(xContentBuilder);
|
||||
|
||||
DocWriteResponse indexResponse = client().execute(IndexAction.INSTANCE, indexRequest).actionGet();
|
||||
DocWriteResponse indexResponse = client().execute(TransportIndexAction.TYPE, indexRequest).actionGet();
|
||||
assertThat(indexResponse.getResult(), is(DocWriteResponse.Result.CREATED));
|
||||
}
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ import org.elasticsearch.action.DocWriteResponse;
|
|||
import org.elasticsearch.action.bulk.BulkAction;
|
||||
import org.elasticsearch.action.bulk.BulkRequest;
|
||||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.support.PlainActionFuture;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
import org.elasticsearch.action.support.master.MasterNodeRequest;
|
||||
|
@ -126,7 +126,7 @@ public class ModelSnapshotSearchIT extends MlNativeAutodetectIntegTestCase {
|
|||
modelSnapshotBuilder.build().toXContent(xContentBuilder, ToXContent.EMPTY_PARAMS);
|
||||
indexRequest.source(xContentBuilder);
|
||||
|
||||
DocWriteResponse indexResponse = client().execute(IndexAction.INSTANCE, indexRequest).actionGet();
|
||||
DocWriteResponse indexResponse = client().execute(TransportIndexAction.TYPE, indexRequest).actionGet();
|
||||
assertThat(indexResponse.getResult(), is(DocWriteResponse.Result.CREATED));
|
||||
}
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
|
||||
package org.elasticsearch.xpack.ml.integration;
|
||||
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
import org.elasticsearch.cluster.node.DiscoveryNodeRole;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
|
@ -108,7 +108,7 @@ public class JobsAndModelsIT extends BaseMlIntegTestCase {
|
|||
try (XContentBuilder builder = JsonXContent.contentBuilder()) {
|
||||
modelDefinitionDoc.toXContent(builder, null);
|
||||
client().execute(
|
||||
IndexAction.INSTANCE,
|
||||
TransportIndexAction.TYPE,
|
||||
new IndexRequest(InferenceIndexConstants.nativeDefinitionStore()).source(builder)
|
||||
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
|
||||
).actionGet();
|
||||
|
|
|
@ -9,8 +9,8 @@ package org.elasticsearch.xpack.ml;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.TransportIndicesAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesAction;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest;
|
||||
import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse;
|
||||
|
@ -202,7 +202,7 @@ public final class MlInitializationService implements ClusterStateListener {
|
|||
.map(aliasAction -> aliasAction.indices()[0] + ": " + String.join(",", aliasAction.aliases()))
|
||||
.collect(Collectors.joining("; "));
|
||||
logger.debug("The following ML internal aliases will now be made hidden: [{}]", indicesWithNonHiddenAliasesString);
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, IndicesAliasesAction.INSTANCE, indicesAliasesRequest, finalListener);
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportIndicesAliasesAction.TYPE, indicesAliasesRequest, finalListener);
|
||||
}, finalListener::onFailure);
|
||||
|
||||
// Step 3: Once indices are hidden, fetch ML internal aliases to find out whether the aliases are hidden or not.
|
||||
|
|
|
@ -8,11 +8,11 @@ package org.elasticsearch.xpack.ml.action;
|
|||
|
||||
import org.elasticsearch.ResourceNotFoundException;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.delete.DeleteAction;
|
||||
import org.elasticsearch.action.delete.DeleteRequest;
|
||||
import org.elasticsearch.action.delete.DeleteResponse;
|
||||
import org.elasticsearch.action.get.GetAction;
|
||||
import org.elasticsearch.action.delete.TransportDeleteAction;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.get.TransportGetAction;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
|
@ -67,7 +67,7 @@ public class TransportDeleteCalendarEventAction extends HandledTransportAction<D
|
|||
|
||||
ActionListener<Calendar> calendarListener = ActionListener.wrap(calendar -> {
|
||||
GetRequest getRequest = new GetRequest(MlMetaIndex.indexName(), eventId);
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, GetAction.INSTANCE, getRequest, ActionListener.wrap(getResponse -> {
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportGetAction.TYPE, getRequest, ActionListener.wrap(getResponse -> {
|
||||
if (getResponse.isExists() == false) {
|
||||
listener.onFailure(new ResourceNotFoundException("No event with id [" + eventId + "]"));
|
||||
return;
|
||||
|
@ -115,7 +115,7 @@ public class TransportDeleteCalendarEventAction extends HandledTransportAction<D
|
|||
DeleteRequest deleteRequest = new DeleteRequest(MlMetaIndex.indexName(), eventId);
|
||||
deleteRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
|
||||
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, DeleteAction.INSTANCE, deleteRequest, new ActionListener<DeleteResponse>() {
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportDeleteAction.TYPE, deleteRequest, new ActionListener<DeleteResponse>() {
|
||||
@Override
|
||||
public void onResponse(DeleteResponse response) {
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ import org.elasticsearch.action.support.ActionFilters;
|
|||
import org.elasticsearch.action.support.WriteRequest;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedTransportMasterNodeAction;
|
||||
import org.elasticsearch.action.update.UpdateAction;
|
||||
import org.elasticsearch.action.update.TransportUpdateAction;
|
||||
import org.elasticsearch.action.update.UpdateRequest;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
|
@ -94,7 +94,7 @@ public class TransportFinalizeJobExecutionAction extends AcknowledgedTransportMa
|
|||
executeAsyncWithOrigin(
|
||||
client,
|
||||
ML_ORIGIN,
|
||||
UpdateAction.INSTANCE,
|
||||
TransportUpdateAction.TYPE,
|
||||
updateRequest,
|
||||
ActionListener.wrap(updateResponse -> chainedListener.onResponse(null), chainedListener::onFailure)
|
||||
);
|
||||
|
|
|
@ -8,8 +8,8 @@ package org.elasticsearch.xpack.ml.action;
|
|||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilities;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest;
|
||||
import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
|
@ -197,7 +197,7 @@ public class TransportPreviewDatafeedAction extends HandledTransportAction<Previ
|
|||
datafeed.getHeaders(),
|
||||
ML_ORIGIN,
|
||||
client,
|
||||
FieldCapabilitiesAction.INSTANCE,
|
||||
TransportFieldCapabilitiesAction.TYPE,
|
||||
fieldCapabilitiesRequest,
|
||||
ActionListener.wrap(fieldCapsResponse -> {
|
||||
Map<String, FieldCapabilities> timeFieldCaps = fieldCapsResponse.getField(timeField);
|
||||
|
|
|
@ -9,8 +9,8 @@ package org.elasticsearch.xpack.ml.action;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.DocWriteRequest;
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
|
@ -65,7 +65,7 @@ public class TransportPutCalendarAction extends HandledTransportAction<PutCalend
|
|||
indexRequest.opType(DocWriteRequest.OpType.CREATE);
|
||||
indexRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
|
||||
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, IndexAction.INSTANCE, indexRequest, new ActionListener<>() {
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportIndexAction.TYPE, indexRequest, new ActionListener<>() {
|
||||
@Override
|
||||
public void onResponse(DocWriteResponse indexResponse) {
|
||||
listener.onResponse(new PutCalendarAction.Response(calendar));
|
||||
|
|
|
@ -10,8 +10,8 @@ import org.elasticsearch.ResourceAlreadyExistsException;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.DocWriteRequest;
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
|
@ -59,7 +59,7 @@ public class TransportPutFilterAction extends HandledTransportAction<PutFilterAc
|
|||
throw new IllegalStateException("Failed to serialise filter with id [" + filter.getId() + "]", e);
|
||||
}
|
||||
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, IndexAction.INSTANCE, indexRequest, new ActionListener<>() {
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportIndexAction.TYPE, indexRequest, new ActionListener<>() {
|
||||
@Override
|
||||
public void onResponse(DocWriteResponse indexResponse) {
|
||||
listener.onResponse(new PutFilterAction.Response(filter));
|
||||
|
|
|
@ -9,11 +9,11 @@ package org.elasticsearch.xpack.ml.action;
|
|||
import org.elasticsearch.ResourceNotFoundException;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.get.GetAction;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.get.TransportGetAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.HandledTransportAction;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
|
@ -135,7 +135,7 @@ public class TransportUpdateFilterAction extends HandledTransportAction<UpdateFi
|
|||
throw new IllegalStateException("Failed to serialise filter with id [" + filter.getId() + "]", e);
|
||||
}
|
||||
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, IndexAction.INSTANCE, indexRequest, new ActionListener<>() {
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportIndexAction.TYPE, indexRequest, new ActionListener<>() {
|
||||
@Override
|
||||
public void onResponse(DocWriteResponse indexResponse) {
|
||||
jobManager.notifyFilterChanged(
|
||||
|
@ -164,7 +164,7 @@ public class TransportUpdateFilterAction extends HandledTransportAction<UpdateFi
|
|||
|
||||
private void getFilterWithVersion(String filterId, ActionListener<FilterWithSeqNo> listener) {
|
||||
GetRequest getRequest = new GetRequest(MlMetaIndex.indexName(), MlFilter.documentId(filterId));
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, GetAction.INSTANCE, getRequest, listener.delegateFailure((l, getDocResponse) -> {
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportGetAction.TYPE, getRequest, listener.delegateFailure((l, getDocResponse) -> {
|
||||
try {
|
||||
if (getDocResponse.isExists()) {
|
||||
BytesReference docSource = getDocResponse.getSourceAsBytesRef();
|
||||
|
|
|
@ -9,9 +9,9 @@ package org.elasticsearch.xpack.ml.datafeed.extractor.scroll;
|
|||
import org.elasticsearch.ResourceNotFoundException;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilities;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesResponse;
|
||||
import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
import org.elasticsearch.index.IndexNotFoundException;
|
||||
import org.elasticsearch.index.query.QueryBuilder;
|
||||
|
@ -152,7 +152,7 @@ public class ScrollDataExtractorFactory implements DataExtractorFactory {
|
|||
.toArray(String[]::new);
|
||||
fieldCapabilitiesRequest.fields(requestFields);
|
||||
ClientHelper.<FieldCapabilitiesResponse>executeWithHeaders(datafeed.getHeaders(), ClientHelper.ML_ORIGIN, client, () -> {
|
||||
client.execute(FieldCapabilitiesAction.INSTANCE, fieldCapabilitiesRequest, fieldCapabilitiesHandler);
|
||||
client.execute(TransportFieldCapabilitiesAction.TYPE, fieldCapabilitiesRequest, fieldCapabilitiesHandler);
|
||||
// This response gets discarded - the listener handles the real response
|
||||
return null;
|
||||
});
|
||||
|
|
|
@ -13,14 +13,14 @@ import org.elasticsearch.action.ActionListener;
|
|||
import org.elasticsearch.action.DelegatingActionListener;
|
||||
import org.elasticsearch.action.DocWriteRequest;
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.delete.DeleteAction;
|
||||
import org.elasticsearch.action.delete.DeleteRequest;
|
||||
import org.elasticsearch.action.delete.DeleteResponse;
|
||||
import org.elasticsearch.action.get.GetAction;
|
||||
import org.elasticsearch.action.delete.TransportDeleteAction;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.get.TransportGetAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
|
@ -138,7 +138,7 @@ public class DatafeedConfigProvider {
|
|||
executeAsyncWithOrigin(
|
||||
client,
|
||||
ML_ORIGIN,
|
||||
IndexAction.INSTANCE,
|
||||
TransportIndexAction.TYPE,
|
||||
indexRequest,
|
||||
ActionListener.wrap(r -> listener.onResponse(Tuple.tuple(finalConfig, r)), e -> {
|
||||
if (ExceptionsHelper.unwrapCause(e) instanceof VersionConflictEngineException) {
|
||||
|
@ -176,7 +176,7 @@ public class DatafeedConfigProvider {
|
|||
if (parentTaskId != null) {
|
||||
getRequest.setParentTask(parentTaskId);
|
||||
}
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, GetAction.INSTANCE, getRequest, new ActionListener<GetResponse>() {
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportGetAction.TYPE, getRequest, new ActionListener<GetResponse>() {
|
||||
@Override
|
||||
public void onResponse(GetResponse getResponse) {
|
||||
if (getResponse.isExists() == false) {
|
||||
|
@ -280,14 +280,20 @@ public class DatafeedConfigProvider {
|
|||
public void deleteDatafeedConfig(String datafeedId, ActionListener<DeleteResponse> actionListener) {
|
||||
DeleteRequest request = new DeleteRequest(MlConfigIndex.indexName(), DatafeedConfig.documentId(datafeedId));
|
||||
request.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, DeleteAction.INSTANCE, request, actionListener.delegateFailure((l, deleteResponse) -> {
|
||||
if (deleteResponse.getResult() == DocWriteResponse.Result.NOT_FOUND) {
|
||||
l.onFailure(ExceptionsHelper.missingDatafeedException(datafeedId));
|
||||
return;
|
||||
}
|
||||
assert deleteResponse.getResult() == DocWriteResponse.Result.DELETED;
|
||||
l.onResponse(deleteResponse);
|
||||
}));
|
||||
executeAsyncWithOrigin(
|
||||
client,
|
||||
ML_ORIGIN,
|
||||
TransportDeleteAction.TYPE,
|
||||
request,
|
||||
actionListener.delegateFailure((l, deleteResponse) -> {
|
||||
if (deleteResponse.getResult() == DocWriteResponse.Result.NOT_FOUND) {
|
||||
l.onFailure(ExceptionsHelper.missingDatafeedException(datafeedId));
|
||||
return;
|
||||
}
|
||||
assert deleteResponse.getResult() == DocWriteResponse.Result.DELETED;
|
||||
l.onResponse(deleteResponse);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -314,42 +320,48 @@ public class DatafeedConfigProvider {
|
|||
) {
|
||||
GetRequest getRequest = new GetRequest(MlConfigIndex.indexName(), DatafeedConfig.documentId(datafeedId));
|
||||
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, GetAction.INSTANCE, getRequest, new DelegatingActionListener<>(updatedConfigListener) {
|
||||
@Override
|
||||
public void onResponse(GetResponse getResponse) {
|
||||
if (getResponse.isExists() == false) {
|
||||
delegate.onFailure(ExceptionsHelper.missingDatafeedException(datafeedId));
|
||||
return;
|
||||
}
|
||||
final long seqNo = getResponse.getSeqNo();
|
||||
final long primaryTerm = getResponse.getPrimaryTerm();
|
||||
BytesReference source = getResponse.getSourceAsBytesRef();
|
||||
DatafeedConfig.Builder configBuilder;
|
||||
try {
|
||||
configBuilder = parseLenientlyFromSource(source);
|
||||
} catch (IOException e) {
|
||||
delegate.onFailure(new ElasticsearchParseException("Failed to parse datafeed config [" + datafeedId + "]", e));
|
||||
return;
|
||||
}
|
||||
executeAsyncWithOrigin(
|
||||
client,
|
||||
ML_ORIGIN,
|
||||
TransportGetAction.TYPE,
|
||||
getRequest,
|
||||
new DelegatingActionListener<>(updatedConfigListener) {
|
||||
@Override
|
||||
public void onResponse(GetResponse getResponse) {
|
||||
if (getResponse.isExists() == false) {
|
||||
delegate.onFailure(ExceptionsHelper.missingDatafeedException(datafeedId));
|
||||
return;
|
||||
}
|
||||
final long seqNo = getResponse.getSeqNo();
|
||||
final long primaryTerm = getResponse.getPrimaryTerm();
|
||||
BytesReference source = getResponse.getSourceAsBytesRef();
|
||||
DatafeedConfig.Builder configBuilder;
|
||||
try {
|
||||
configBuilder = parseLenientlyFromSource(source);
|
||||
} catch (IOException e) {
|
||||
delegate.onFailure(new ElasticsearchParseException("Failed to parse datafeed config [" + datafeedId + "]", e));
|
||||
return;
|
||||
}
|
||||
|
||||
DatafeedConfig updatedConfig;
|
||||
try {
|
||||
updatedConfig = update.apply(configBuilder.build(), headers, clusterService.state());
|
||||
} catch (Exception e) {
|
||||
delegate.onFailure(e);
|
||||
return;
|
||||
}
|
||||
DatafeedConfig updatedConfig;
|
||||
try {
|
||||
updatedConfig = update.apply(configBuilder.build(), headers, clusterService.state());
|
||||
} catch (Exception e) {
|
||||
delegate.onFailure(e);
|
||||
return;
|
||||
}
|
||||
|
||||
ActionListener<Boolean> validatedListener = ActionListener.wrap(
|
||||
ok -> indexUpdatedConfig(updatedConfig, seqNo, primaryTerm, ActionListener.wrap(indexResponse -> {
|
||||
assert indexResponse.getResult() == DocWriteResponse.Result.UPDATED;
|
||||
delegate.onResponse(updatedConfig);
|
||||
}, delegate::onFailure)),
|
||||
delegate::onFailure
|
||||
);
|
||||
validator.accept(updatedConfig, validatedListener);
|
||||
ActionListener<Boolean> validatedListener = ActionListener.wrap(
|
||||
ok -> indexUpdatedConfig(updatedConfig, seqNo, primaryTerm, ActionListener.wrap(indexResponse -> {
|
||||
assert indexResponse.getResult() == DocWriteResponse.Result.UPDATED;
|
||||
delegate.onResponse(updatedConfig);
|
||||
}, delegate::onFailure)),
|
||||
delegate::onFailure
|
||||
);
|
||||
validator.accept(updatedConfig, validatedListener);
|
||||
}
|
||||
}
|
||||
});
|
||||
);
|
||||
}
|
||||
|
||||
private void indexUpdatedConfig(DatafeedConfig updatedConfig, long seqNo, long primaryTerm, ActionListener<DocWriteResponse> listener) {
|
||||
|
@ -362,7 +374,7 @@ public class DatafeedConfigProvider {
|
|||
indexRequest.setIfSeqNo(seqNo);
|
||||
indexRequest.setIfPrimaryTerm(primaryTerm);
|
||||
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, IndexAction.INSTANCE, indexRequest, listener);
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportIndexAction.TYPE, indexRequest, listener);
|
||||
|
||||
} catch (IOException e) {
|
||||
listener.onFailure(
|
||||
|
|
|
@ -11,8 +11,8 @@ import org.apache.logging.log4j.Logger;
|
|||
import org.apache.lucene.util.SetOnce;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.search.TransportSearchAction;
|
||||
|
@ -262,7 +262,7 @@ public class DataFrameAnalyticsTask extends LicensedAllocatedPersistentTask impl
|
|||
storedProgress.get().toXContent(jsonBuilder, Payload.XContent.EMPTY_PARAMS);
|
||||
indexRequest.source(jsonBuilder);
|
||||
}
|
||||
executeAsyncWithOrigin(clientToUse, ML_ORIGIN, IndexAction.INSTANCE, indexRequest, indexProgressDocListener);
|
||||
executeAsyncWithOrigin(clientToUse, ML_ORIGIN, TransportIndexAction.TYPE, indexRequest, indexProgressDocListener);
|
||||
}, e -> {
|
||||
LOGGER.error(
|
||||
() -> format("[%s] cannot persist progress as an error occurred while retrieving former progress document", jobId),
|
||||
|
|
|
@ -18,9 +18,9 @@ import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
|
|||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsAction;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesResponse;
|
||||
import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
|
@ -183,7 +183,7 @@ public final class DestinationIndex {
|
|||
config.getHeaders(),
|
||||
ML_ORIGIN,
|
||||
client,
|
||||
FieldCapabilitiesAction.INSTANCE,
|
||||
TransportFieldCapabilitiesAction.TYPE,
|
||||
fieldCapabilitiesRequest,
|
||||
listener
|
||||
);
|
||||
|
|
|
@ -14,9 +14,9 @@ import org.elasticsearch.action.admin.indices.settings.get.GetSettingsAction;
|
|||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilities;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesResponse;
|
||||
import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.search.TransportSearchAction;
|
||||
|
@ -182,7 +182,7 @@ public class ExtractedFieldsDetectorFactory {
|
|||
fieldCapabilitiesRequest.runtimeFields(config.getSource().getRuntimeMappings());
|
||||
LOGGER.debug(() -> format("[%s] Requesting field caps for index %s", config.getId(), Arrays.toString(index)));
|
||||
ClientHelper.executeWithHeaders(config.getHeaders(), ML_ORIGIN, client, () -> {
|
||||
client.execute(FieldCapabilitiesAction.INSTANCE, fieldCapabilitiesRequest, listener);
|
||||
client.execute(TransportFieldCapabilitiesAction.TYPE, fieldCapabilitiesRequest, listener);
|
||||
// This response gets discarded - the listener handles the real response
|
||||
return null;
|
||||
});
|
||||
|
|
|
@ -13,11 +13,11 @@ import org.elasticsearch.ResourceNotFoundException;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.DelegatingActionListener;
|
||||
import org.elasticsearch.action.DocWriteRequest;
|
||||
import org.elasticsearch.action.get.GetAction;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.get.TransportGetAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
|
@ -139,7 +139,7 @@ public class DataFrameAnalyticsConfigProvider {
|
|||
|
||||
GetRequest getRequest = new GetRequest(MlConfigIndex.indexName(), DataFrameAnalyticsConfig.documentId(jobId));
|
||||
getRequest.fetchSourceContext(FetchSourceContext.DO_NOT_FETCH_SOURCE);
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, GetAction.INSTANCE, getRequest, getListener);
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportGetAction.TYPE, getRequest, getListener);
|
||||
}
|
||||
|
||||
private void deleteLeftOverDocs(DataFrameAnalyticsConfig config, TimeValue timeout, ActionListener<AcknowledgedResponse> listener) {
|
||||
|
@ -166,7 +166,7 @@ public class DataFrameAnalyticsConfigProvider {
|
|||
String id = update.getId();
|
||||
|
||||
GetRequest getRequest = new GetRequest(MlConfigIndex.indexName(), DataFrameAnalyticsConfig.documentId(id));
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, GetAction.INSTANCE, getRequest, ActionListener.wrap(getResponse -> {
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportGetAction.TYPE, getRequest, ActionListener.wrap(getResponse -> {
|
||||
|
||||
// Fail the update request if the config to be updated doesn't exist
|
||||
if (getResponse.isExists() == false) {
|
||||
|
@ -255,7 +255,7 @@ public class DataFrameAnalyticsConfigProvider {
|
|||
executeAsyncWithOrigin(
|
||||
client,
|
||||
ML_ORIGIN,
|
||||
IndexAction.INSTANCE,
|
||||
TransportIndexAction.TYPE,
|
||||
indexRequest,
|
||||
ActionListener.wrap(indexResponse -> listener.onResponse(config), e -> {
|
||||
if (ExceptionsHelper.unwrapCause(e) instanceof VersionConflictEngineException) {
|
||||
|
|
|
@ -12,8 +12,8 @@ import org.apache.logging.log4j.Logger;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.bulk.BulkItemResponse;
|
||||
import org.elasticsearch.action.delete.DeleteAction;
|
||||
import org.elasticsearch.action.delete.DeleteRequest;
|
||||
import org.elasticsearch.action.delete.TransportDeleteAction;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
@ -107,7 +107,7 @@ public class DataFrameAnalyticsDeleter {
|
|||
DeleteRequest deleteRequest = new DeleteRequest(MlConfigIndex.indexName());
|
||||
deleteRequest.id(DataFrameAnalyticsConfig.documentId(id));
|
||||
deleteRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, DeleteAction.INSTANCE, deleteRequest, ActionListener.wrap(deleteResponse -> {
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportDeleteAction.TYPE, deleteRequest, ActionListener.wrap(deleteResponse -> {
|
||||
if (deleteResponse.getResult() == DocWriteResponse.Result.NOT_FOUND) {
|
||||
listener.onFailure(ExceptionsHelper.missingDataFrameAnalytics(id));
|
||||
return;
|
||||
|
|
|
@ -14,8 +14,8 @@ import org.elasticsearch.action.DocWriteResponse;
|
|||
import org.elasticsearch.action.admin.indices.refresh.RefreshAction;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
|
||||
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.client.internal.node.NodeClient;
|
||||
import org.elasticsearch.core.TimeValue;
|
||||
|
@ -83,7 +83,7 @@ public class FinalStep extends AbstractDataFrameAnalyticsStep {
|
|||
IndexRequest indexRequest = new IndexRequest(MlStatsIndex.writeAlias()).id(DataCounts.documentId(config.getId()))
|
||||
.setRequireAlias(true)
|
||||
.source(builder);
|
||||
executeAsyncWithOrigin(parentTaskClient(), ML_ORIGIN, IndexAction.INSTANCE, indexRequest, listener);
|
||||
executeAsyncWithOrigin(parentTaskClient(), ML_ORIGIN, TransportIndexAction.TYPE, indexRequest, listener);
|
||||
} catch (IOException e) {
|
||||
listener.onFailure(ExceptionsHelper.serverError("[{}] Error persisting final data counts", e, config.getId()));
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ import org.elasticsearch.action.bulk.BulkAction;
|
|||
import org.elasticsearch.action.bulk.BulkItemResponse;
|
||||
import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
||||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.search.MultiSearchRequest;
|
||||
import org.elasticsearch.action.search.MultiSearchResponse;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
|
@ -206,7 +206,7 @@ public class TrainedModelProvider {
|
|||
executeAsyncWithOrigin(
|
||||
client,
|
||||
ML_ORIGIN,
|
||||
IndexAction.INSTANCE,
|
||||
TransportIndexAction.TYPE,
|
||||
request,
|
||||
ActionListener.wrap(indexResponse -> listener.onResponse(true), e -> {
|
||||
if (ExceptionsHelper.unwrapCause(e) instanceof VersionConflictEngineException) {
|
||||
|
@ -255,7 +255,7 @@ public class TrainedModelProvider {
|
|||
executeAsyncWithOrigin(
|
||||
client,
|
||||
ML_ORIGIN,
|
||||
IndexAction.INSTANCE,
|
||||
TransportIndexAction.TYPE,
|
||||
createRequest(VocabularyConfig.docId(modelId), vocabularyConfig.getIndex(), vocabulary, allowOverwriting).setRefreshPolicy(
|
||||
WriteRequest.RefreshPolicy.IMMEDIATE
|
||||
),
|
||||
|
@ -303,7 +303,7 @@ public class TrainedModelProvider {
|
|||
executeAsyncWithOrigin(
|
||||
client,
|
||||
ML_ORIGIN,
|
||||
IndexAction.INSTANCE,
|
||||
TransportIndexAction.TYPE,
|
||||
createRequest(trainedModelDefinitionDoc.getDocId(), index, trainedModelDefinitionDoc, allowOverwriting),
|
||||
ActionListener.wrap(indexResponse -> listener.onResponse(null), e -> {
|
||||
if (ExceptionsHelper.unwrapCause(e) instanceof VersionConflictEngineException) {
|
||||
|
@ -353,7 +353,7 @@ public class TrainedModelProvider {
|
|||
executeAsyncWithOrigin(
|
||||
client,
|
||||
ML_ORIGIN,
|
||||
IndexAction.INSTANCE,
|
||||
TransportIndexAction.TYPE,
|
||||
createRequest(
|
||||
trainedModelMetadata.getDocId(),
|
||||
InferenceIndexConstants.LATEST_INDEX_NAME,
|
||||
|
|
|
@ -14,14 +14,14 @@ import org.elasticsearch.action.ActionListener;
|
|||
import org.elasticsearch.action.DelegatingActionListener;
|
||||
import org.elasticsearch.action.DocWriteRequest;
|
||||
import org.elasticsearch.action.DocWriteResponse;
|
||||
import org.elasticsearch.action.delete.DeleteAction;
|
||||
import org.elasticsearch.action.delete.DeleteRequest;
|
||||
import org.elasticsearch.action.delete.DeleteResponse;
|
||||
import org.elasticsearch.action.get.GetAction;
|
||||
import org.elasticsearch.action.delete.TransportDeleteAction;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.get.TransportGetAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.search.SearchRequest;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
|
@ -127,14 +127,20 @@ public class JobConfigProvider {
|
|||
.opType(DocWriteRequest.OpType.CREATE)
|
||||
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
|
||||
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, IndexAction.INSTANCE, indexRequest, ActionListener.wrap(listener::onResponse, e -> {
|
||||
if (ExceptionsHelper.unwrapCause(e) instanceof VersionConflictEngineException) {
|
||||
// the job already exists
|
||||
listener.onFailure(ExceptionsHelper.jobAlreadyExists(job.getId()));
|
||||
} else {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
}));
|
||||
executeAsyncWithOrigin(
|
||||
client,
|
||||
ML_ORIGIN,
|
||||
TransportIndexAction.TYPE,
|
||||
indexRequest,
|
||||
ActionListener.wrap(listener::onResponse, e -> {
|
||||
if (ExceptionsHelper.unwrapCause(e) instanceof VersionConflictEngineException) {
|
||||
// the job already exists
|
||||
listener.onFailure(ExceptionsHelper.jobAlreadyExists(job.getId()));
|
||||
} else {
|
||||
listener.onFailure(e);
|
||||
}
|
||||
})
|
||||
);
|
||||
|
||||
} catch (IOException e) {
|
||||
listener.onFailure(new ElasticsearchParseException("Failed to serialise job with id [" + job.getId() + "]", e));
|
||||
|
@ -196,16 +202,22 @@ public class JobConfigProvider {
|
|||
DeleteRequest request = new DeleteRequest(MlConfigIndex.indexName(), Job.documentId(jobId));
|
||||
request.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE);
|
||||
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, DeleteAction.INSTANCE, request, actionListener.delegateFailure((l, deleteResponse) -> {
|
||||
if (errorIfMissing) {
|
||||
if (deleteResponse.getResult() == DocWriteResponse.Result.NOT_FOUND) {
|
||||
l.onFailure(ExceptionsHelper.missingJobException(jobId));
|
||||
return;
|
||||
executeAsyncWithOrigin(
|
||||
client,
|
||||
ML_ORIGIN,
|
||||
TransportDeleteAction.TYPE,
|
||||
request,
|
||||
actionListener.delegateFailure((l, deleteResponse) -> {
|
||||
if (errorIfMissing) {
|
||||
if (deleteResponse.getResult() == DocWriteResponse.Result.NOT_FOUND) {
|
||||
l.onFailure(ExceptionsHelper.missingJobException(jobId));
|
||||
return;
|
||||
}
|
||||
assert deleteResponse.getResult() == DocWriteResponse.Result.DELETED;
|
||||
}
|
||||
assert deleteResponse.getResult() == DocWriteResponse.Result.DELETED;
|
||||
}
|
||||
l.onResponse(deleteResponse);
|
||||
}));
|
||||
l.onResponse(deleteResponse);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -223,7 +235,7 @@ public class JobConfigProvider {
|
|||
public void updateJob(String jobId, JobUpdate update, ByteSizeValue maxModelMemoryLimit, ActionListener<Job> updatedJobListener) {
|
||||
GetRequest getRequest = new GetRequest(MlConfigIndex.indexName(), Job.documentId(jobId));
|
||||
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, GetAction.INSTANCE, getRequest, new DelegatingActionListener<>(updatedJobListener) {
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportGetAction.TYPE, getRequest, new DelegatingActionListener<>(updatedJobListener) {
|
||||
@Override
|
||||
public void onResponse(GetResponse getResponse) {
|
||||
if (getResponse.isExists() == false) {
|
||||
|
@ -285,7 +297,7 @@ public class JobConfigProvider {
|
|||
) {
|
||||
GetRequest getRequest = new GetRequest(MlConfigIndex.indexName(), Job.documentId(jobId));
|
||||
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, GetAction.INSTANCE, getRequest, ActionListener.wrap(getResponse -> {
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportGetAction.TYPE, getRequest, ActionListener.wrap(getResponse -> {
|
||||
if (getResponse.isExists() == false) {
|
||||
listener.onFailure(ExceptionsHelper.missingJobException(jobId));
|
||||
return;
|
||||
|
@ -332,7 +344,7 @@ public class JobConfigProvider {
|
|||
indexRequest.setIfSeqNo(seqNo);
|
||||
indexRequest.setIfPrimaryTerm(primaryTerm);
|
||||
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, IndexAction.INSTANCE, indexRequest, ActionListener.wrap(indexResponse -> {
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportIndexAction.TYPE, indexRequest, ActionListener.wrap(indexResponse -> {
|
||||
assert indexResponse.getResult() == DocWriteResponse.Result.UPDATED;
|
||||
updatedJobListener.onResponse(updatedJob);
|
||||
}, updatedJobListener::onFailure));
|
||||
|
@ -366,7 +378,7 @@ public class JobConfigProvider {
|
|||
getRequest.setParentTask(parentTaskId);
|
||||
}
|
||||
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, GetAction.INSTANCE, getRequest, ActionListener.wrap(getResponse -> {
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportGetAction.TYPE, getRequest, ActionListener.wrap(getResponse -> {
|
||||
if (getResponse.isExists() == false) {
|
||||
if (errorIfMissing) {
|
||||
listener.onFailure(ExceptionsHelper.missingJobException(jobId));
|
||||
|
|
|
@ -9,8 +9,8 @@ package org.elasticsearch.xpack.ml.job.persistence;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.support.WriteRequest;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
import org.elasticsearch.xcontent.ToXContent;
|
||||
|
@ -124,7 +124,7 @@ public class JobDataCountsPersister {
|
|||
.setRequireAlias(true)
|
||||
.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE)
|
||||
.source(content);
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, IndexAction.INSTANCE, request, listener.safeMap(r -> true));
|
||||
executeAsyncWithOrigin(client, ML_ORIGIN, TransportIndexAction.TYPE, request, listener.safeMap(r -> true));
|
||||
} catch (IOException ioe) {
|
||||
String msg = "[" + jobId + "] Failed writing data_counts stats";
|
||||
logger.error(msg, ioe);
|
||||
|
|
|
@ -11,7 +11,7 @@ import org.elasticsearch.action.ActionListener;
|
|||
import org.elasticsearch.action.support.ActionFilters;
|
||||
import org.elasticsearch.action.support.ActionTestUtils;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.action.update.UpdateAction;
|
||||
import org.elasticsearch.action.update.TransportUpdateAction;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
import org.elasticsearch.cluster.ClusterName;
|
||||
import org.elasticsearch.cluster.ClusterState;
|
||||
|
@ -59,7 +59,7 @@ public class TransportFinalizeJobExecutionActionTests extends ESTestCase {
|
|||
ActionListener listener = (ActionListener) invocationOnMock.getArguments()[2];
|
||||
listener.onResponse(null);
|
||||
return null;
|
||||
}).when(client).execute(eq(UpdateAction.INSTANCE), any(), any());
|
||||
}).when(client).execute(eq(TransportUpdateAction.TYPE), any(), any());
|
||||
|
||||
when(client.threadPool()).thenReturn(threadPool);
|
||||
when(threadPool.getThreadContext()).thenReturn(new ThreadContext(Settings.EMPTY));
|
||||
|
@ -76,7 +76,7 @@ public class TransportFinalizeJobExecutionActionTests extends ESTestCase {
|
|||
action.masterOperation(null, request, clusterState, ActionTestUtils.assertNoFailureListener(ack::set));
|
||||
|
||||
assertTrue(ack.get().isAcknowledged());
|
||||
verify(client, times(2)).execute(eq(UpdateAction.INSTANCE), any(), any());
|
||||
verify(client, times(2)).execute(eq(TransportUpdateAction.TYPE), any(), any());
|
||||
verify(clusterService, never()).submitUnbatchedStateUpdateTask(any(), any());
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ package org.elasticsearch.xpack.ml.datafeed.extractor;
|
|||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilities;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesResponse;
|
||||
import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.support.ActionTestUtils;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
|
@ -94,7 +94,7 @@ public class DataExtractorFactoryTests extends ESTestCase {
|
|||
ActionListener listener = (ActionListener) invocationMock.getArguments()[2];
|
||||
listener.onResponse(fieldsCapabilities);
|
||||
return null;
|
||||
}).when(client).execute(same(FieldCapabilitiesAction.INSTANCE), any(), any());
|
||||
}).when(client).execute(same(TransportFieldCapabilitiesAction.TYPE), any(), any());
|
||||
|
||||
doAnswer(invocationMock -> {
|
||||
ActionListener listener = (ActionListener) invocationMock.getArguments()[2];
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
package org.elasticsearch.xpack.ml.dataframe;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.search.TransportSearchAction;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
|
@ -191,7 +191,7 @@ public class DataFrameAnalyticsTaskTests extends ESTestCase {
|
|||
doAnswer(withResponse(searchResponse)).when(client).execute(eq(TransportSearchAction.TYPE), any(), any());
|
||||
|
||||
IndexResponse indexResponse = mock(IndexResponse.class);
|
||||
doAnswer(withResponse(indexResponse)).when(client).execute(eq(IndexAction.INSTANCE), any(), any());
|
||||
doAnswer(withResponse(indexResponse)).when(client).execute(eq(TransportIndexAction.TYPE), any(), any());
|
||||
|
||||
TaskManager taskManager = mock(TaskManager.class);
|
||||
|
||||
|
@ -218,7 +218,7 @@ public class DataFrameAnalyticsTaskTests extends ESTestCase {
|
|||
|
||||
InOrder inOrder = inOrder(client, runnable);
|
||||
inOrder.verify(client).execute(eq(TransportSearchAction.TYPE), any(), any());
|
||||
inOrder.verify(client).execute(eq(IndexAction.INSTANCE), indexRequestCaptor.capture(), any());
|
||||
inOrder.verify(client).execute(eq(TransportIndexAction.TYPE), indexRequestCaptor.capture(), any());
|
||||
inOrder.verify(runnable).run();
|
||||
inOrder.verifyNoMoreInteractions();
|
||||
|
||||
|
@ -287,7 +287,7 @@ public class DataFrameAnalyticsTaskTests extends ESTestCase {
|
|||
doAnswer(withResponse(searchResponse)).when(client).execute(eq(TransportSearchAction.TYPE), any(), any());
|
||||
|
||||
IndexResponse indexResponse = mock(IndexResponse.class);
|
||||
doAnswer(withResponse(indexResponse)).when(client).execute(eq(IndexAction.INSTANCE), any(), any());
|
||||
doAnswer(withResponse(indexResponse)).when(client).execute(eq(TransportIndexAction.TYPE), any(), any());
|
||||
|
||||
DataFrameAnalyticsTask task = new DataFrameAnalyticsTask(
|
||||
123,
|
||||
|
@ -316,7 +316,7 @@ public class DataFrameAnalyticsTaskTests extends ESTestCase {
|
|||
// Verify progress was persisted
|
||||
ArgumentCaptor<IndexRequest> indexRequestCaptor = ArgumentCaptor.forClass(IndexRequest.class);
|
||||
verify(client).execute(eq(TransportSearchAction.TYPE), any(), any());
|
||||
verify(client).execute(eq(IndexAction.INSTANCE), indexRequestCaptor.capture(), any());
|
||||
verify(client).execute(eq(TransportIndexAction.TYPE), indexRequestCaptor.capture(), any());
|
||||
|
||||
IndexRequest indexRequest = indexRequestCaptor.getValue();
|
||||
assertThat(indexRequest.index(), equalTo(AnomalyDetectorsIndex.jobStateIndexWriteAlias()));
|
||||
|
|
|
@ -20,9 +20,9 @@ import org.elasticsearch.action.admin.indices.settings.get.GetSettingsAction;
|
|||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest;
|
||||
import org.elasticsearch.action.admin.indices.settings.get.GetSettingsResponse;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilities;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesResponse;
|
||||
import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.support.ActionTestUtils;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
|
@ -293,7 +293,7 @@ public class DestinationIndexTests extends ESTestCase {
|
|||
});
|
||||
|
||||
doAnswer(callListenerOnResponse(fieldCapabilitiesResponse)).when(client)
|
||||
.execute(eq(FieldCapabilitiesAction.INSTANCE), fieldCapabilitiesRequestCaptor.capture(), any());
|
||||
.execute(eq(TransportFieldCapabilitiesAction.TYPE), fieldCapabilitiesRequestCaptor.capture(), any());
|
||||
|
||||
String errorMessage = "";
|
||||
switch (expectedError) {
|
||||
|
@ -627,7 +627,7 @@ public class DestinationIndexTests extends ESTestCase {
|
|||
});
|
||||
|
||||
doAnswer(callListenerOnResponse(fieldCapabilitiesResponse)).when(client)
|
||||
.execute(eq(FieldCapabilitiesAction.INSTANCE), fieldCapabilitiesRequestCaptor.capture(), any());
|
||||
.execute(eq(TransportFieldCapabilitiesAction.TYPE), fieldCapabilitiesRequestCaptor.capture(), any());
|
||||
|
||||
DestinationIndex.updateMappingsToDestIndex(
|
||||
client,
|
||||
|
@ -637,7 +637,7 @@ public class DestinationIndexTests extends ESTestCase {
|
|||
);
|
||||
|
||||
verify(client, atLeastOnce()).threadPool();
|
||||
verify(client, atMost(1)).execute(eq(FieldCapabilitiesAction.INSTANCE), any(), any());
|
||||
verify(client, atMost(1)).execute(eq(TransportFieldCapabilitiesAction.TYPE), any(), any());
|
||||
verify(client).execute(eq(PutMappingAction.INSTANCE), any(), any());
|
||||
verifyNoMoreInteractions(client);
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ import org.elasticsearch.ElasticsearchException;
|
|||
import org.elasticsearch.action.DocWriteRequest;
|
||||
import org.elasticsearch.action.bulk.BulkAction;
|
||||
import org.elasticsearch.action.bulk.BulkRequest;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.support.PlainActionFuture;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
|
@ -542,7 +542,7 @@ public class TrainedModelProviderTests extends ESTestCase {
|
|||
|
||||
private void assertThatIndexRequestHasOperation(Client client, DocWriteRequest.OpType operation) {
|
||||
var indexRequestArg = ArgumentCaptor.forClass(IndexRequest.class);
|
||||
verify(client).execute(eq(IndexAction.INSTANCE), indexRequestArg.capture(), any());
|
||||
verify(client).execute(eq(TransportIndexAction.TYPE), indexRequestArg.capture(), any());
|
||||
assertThat(indexRequestArg.getValue().opType(), Matchers.is(operation));
|
||||
}
|
||||
|
||||
|
|
|
@ -11,9 +11,9 @@ import org.elasticsearch.action.DocWriteResponse;
|
|||
import org.elasticsearch.action.bulk.BulkAction;
|
||||
import org.elasticsearch.action.bulk.BulkRequest;
|
||||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.search.TransportSearchAction;
|
||||
import org.elasticsearch.action.support.ActionTestUtils;
|
||||
|
@ -373,7 +373,7 @@ public class JobResultsPersisterTests extends ESTestCase {
|
|||
doAnswer(withResponse(searchResponse)).when(client).execute(eq(TransportSearchAction.TYPE), any(), any());
|
||||
|
||||
IndexResponse indexResponse = mock(IndexResponse.class);
|
||||
doAnswer(withResponse(indexResponse)).when(client).execute(eq(IndexAction.INSTANCE), any(), any());
|
||||
doAnswer(withResponse(indexResponse)).when(client).execute(eq(TransportIndexAction.TYPE), any(), any());
|
||||
|
||||
Quantiles quantiles = new Quantiles("foo", new Date(), "bar");
|
||||
ActionListener<DocWriteResponse> indexResponseListener = mock(ActionListener.class);
|
||||
|
@ -381,7 +381,7 @@ public class JobResultsPersisterTests extends ESTestCase {
|
|||
|
||||
InOrder inOrder = inOrder(client, indexResponseListener);
|
||||
inOrder.verify(client).execute(eq(TransportSearchAction.TYPE), any(), any());
|
||||
inOrder.verify(client).execute(eq(IndexAction.INSTANCE), indexRequestCaptor.capture(), any());
|
||||
inOrder.verify(client).execute(eq(TransportIndexAction.TYPE), indexRequestCaptor.capture(), any());
|
||||
inOrder.verify(indexResponseListener).onResponse(any());
|
||||
inOrder.verifyNoMoreInteractions();
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.elasticsearch.ElasticsearchException;
|
|||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.ActionType;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.admin.cluster.health.TransportClusterHealthAction;
|
||||
import org.elasticsearch.action.support.ActionTestUtils;
|
||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
|
@ -163,6 +164,13 @@ public class AutodetectProcessManagerTests extends ESTestCase {
|
|||
doAnswer(invocationOnMock -> {
|
||||
if (invocationOnMock.getArguments()[0] instanceof ActionType<?> v) {
|
||||
ActionListener<?> l = (ActionListener<?>) invocationOnMock.getArguments()[2];
|
||||
if (v == TransportClusterHealthAction.TYPE) {
|
||||
ActionListener<ClusterHealthResponse> listener = (ActionListener<ClusterHealthResponse>) l;
|
||||
listener.onResponse(
|
||||
new ClusterHealthResponse("test", new String[0], ClusterState.EMPTY_STATE, 0, 0, 0, TimeValue.ZERO)
|
||||
);
|
||||
return null;
|
||||
}
|
||||
ParameterizedType parameterizedType = (ParameterizedType) v.getClass().getGenericSuperclass();
|
||||
Type t = parameterizedType.getActualTypeArguments()[0];
|
||||
if (t.getTypeName().contains("AcknowledgedResponse")) {
|
||||
|
@ -170,13 +178,6 @@ public class AutodetectProcessManagerTests extends ESTestCase {
|
|||
listener.onResponse(AcknowledgedResponse.TRUE);
|
||||
return null;
|
||||
}
|
||||
if (t.getTypeName().contains("ClusterHealthResponse")) {
|
||||
ActionListener<ClusterHealthResponse> listener = (ActionListener<ClusterHealthResponse>) l;
|
||||
listener.onResponse(
|
||||
new ClusterHealthResponse("test", new String[0], ClusterState.EMPTY_STATE, 0, 0, 0, TimeValue.ZERO)
|
||||
);
|
||||
return null;
|
||||
}
|
||||
fail("Mock not configured to handle generic type " + t.getTypeName());
|
||||
}
|
||||
return null;
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
package org.elasticsearch.xpack.searchablesnapshots.cache.blob;
|
||||
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
import org.elasticsearch.action.get.GetAction;
|
||||
import org.elasticsearch.action.get.GetRequest;
|
||||
import org.elasticsearch.action.get.GetResponse;
|
||||
import org.elasticsearch.action.index.IndexAction;
|
||||
import org.elasticsearch.action.get.TransportGetAction;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.action.index.TransportIndexAction;
|
||||
import org.elasticsearch.action.support.PlainActionFuture;
|
||||
import org.elasticsearch.blobcache.common.ByteRange;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
|
@ -98,7 +98,7 @@ public class BlobStoreCacheServiceTests extends ESTestCase {
|
|||
)
|
||||
);
|
||||
return null;
|
||||
}).when(mockClient).execute(eq(GetAction.INSTANCE), any(GetRequest.class), any(ActionListener.class));
|
||||
}).when(mockClient).execute(eq(TransportGetAction.TYPE), any(GetRequest.class), any(ActionListener.class));
|
||||
|
||||
BlobStoreCacheService blobCacheService = new BlobStoreCacheService(null, mockClient, SNAPSHOT_BLOB_CACHE_INDEX);
|
||||
blobCacheService.start();
|
||||
|
@ -130,7 +130,7 @@ public class BlobStoreCacheServiceTests extends ESTestCase {
|
|||
)
|
||||
);
|
||||
return null;
|
||||
}).when(mockClient).execute(eq(IndexAction.INSTANCE), any(IndexRequest.class), any(ActionListener.class));
|
||||
}).when(mockClient).execute(eq(TransportIndexAction.TYPE), any(IndexRequest.class), any(ActionListener.class));
|
||||
|
||||
BlobStoreCacheService blobCacheService = new BlobStoreCacheService(null, mockClient, SNAPSHOT_BLOB_CACHE_INDEX);
|
||||
blobCacheService.start();
|
||||
|
@ -168,7 +168,7 @@ public class BlobStoreCacheServiceTests extends ESTestCase {
|
|||
)
|
||||
);
|
||||
return null;
|
||||
}).when(mockClient).execute(eq(IndexAction.INSTANCE), any(IndexRequest.class), any(ActionListener.class));
|
||||
}).when(mockClient).execute(eq(TransportIndexAction.TYPE), any(IndexRequest.class), any(ActionListener.class));
|
||||
|
||||
final BlobStoreCacheService blobCacheService = new BlobStoreCacheService(null, mockClient, SNAPSHOT_BLOB_CACHE_INDEX);
|
||||
blobCacheService.start();
|
||||
|
|
|
@ -10,9 +10,9 @@ package org.elasticsearch.xpack.remotecluster;
|
|||
import org.elasticsearch.ElasticsearchSecurityException;
|
||||
import org.elasticsearch.TransportVersion;
|
||||
import org.elasticsearch.action.admin.cluster.remote.RemoteClusterNodesAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesAction;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesRequest;
|
||||
import org.elasticsearch.action.fieldcaps.FieldCapabilitiesResponse;
|
||||
import org.elasticsearch.action.fieldcaps.TransportFieldCapabilitiesAction;
|
||||
import org.elasticsearch.client.Request;
|
||||
import org.elasticsearch.client.Response;
|
||||
import org.elasticsearch.client.internal.Client;
|
||||
|
@ -344,7 +344,7 @@ public class RemoteClusterSecurityFcActionAuthorizationIT extends ESRestTestCase
|
|||
"node",
|
||||
threadPool,
|
||||
(String) crossClusterApiKeyMap.get("encoded"),
|
||||
Map.of(FieldCapabilitiesAction.NAME, crossClusterAccessSubjectInfo)
|
||||
Map.of(TransportFieldCapabilitiesAction.NAME, crossClusterAccessSubjectInfo)
|
||||
)
|
||||
) {
|
||||
final RemoteClusterService remoteClusterService = service.getRemoteClusterService();
|
||||
|
@ -360,7 +360,7 @@ public class RemoteClusterSecurityFcActionAuthorizationIT extends ESRestTestCase
|
|||
// 1. Not accessible because API key does not grant the access
|
||||
final ElasticsearchSecurityException e1 = expectThrows(
|
||||
ElasticsearchSecurityException.class,
|
||||
() -> remoteClusterClient.execute(FieldCapabilitiesAction.INSTANCE, request).actionGet()
|
||||
() -> remoteClusterClient.execute(TransportFieldCapabilitiesAction.TYPE, request).actionGet()
|
||||
);
|
||||
assertThat(
|
||||
e1.getMessage(),
|
||||
|
@ -387,7 +387,7 @@ public class RemoteClusterSecurityFcActionAuthorizationIT extends ESRestTestCase
|
|||
}""");
|
||||
assertOK(performRequestWithAdminUser(adminClient(), updateApiKeyRequest));
|
||||
final FieldCapabilitiesResponse fieldCapabilitiesResponse = remoteClusterClient.execute(
|
||||
FieldCapabilitiesAction.INSTANCE,
|
||||
TransportFieldCapabilitiesAction.TYPE,
|
||||
request
|
||||
).actionGet();
|
||||
assertThat(fieldCapabilitiesResponse.getIndices(), arrayContaining("index"));
|
||||
|
@ -407,7 +407,7 @@ public class RemoteClusterSecurityFcActionAuthorizationIT extends ESRestTestCase
|
|||
assertOK(performRequestWithAdminUser(adminClient(), updateApiKeyRequest));
|
||||
final ElasticsearchSecurityException e2 = expectThrows(
|
||||
ElasticsearchSecurityException.class,
|
||||
() -> remoteClusterClient.execute(FieldCapabilitiesAction.INSTANCE, request).actionGet()
|
||||
() -> remoteClusterClient.execute(TransportFieldCapabilitiesAction.TYPE, request).actionGet()
|
||||
);
|
||||
assertThat(
|
||||
e2.getMessage(),
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue