Skip to content

Commit

Permalink
Moving reload_analyzers endpoint to xpack (#43559)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christoph Büscher committed Jun 25, 2019
1 parent cdb2d41 commit d92da88
Show file tree
Hide file tree
Showing 23 changed files with 125 additions and 300 deletions.
2 changes: 1 addition & 1 deletion docs/reference/indices/apis/reload-analyzers.asciidoc
Expand Up @@ -13,7 +13,7 @@ with the `updateable` flag:

[source,js]
--------------------------------------------------
PUT /test_index
PUT /my_index
{
"settings": {
"index" : {
Expand Down
Expand Up @@ -121,8 +121,6 @@
import org.elasticsearch.action.admin.indices.recovery.TransportRecoveryAction;
import org.elasticsearch.action.admin.indices.refresh.RefreshAction;
import org.elasticsearch.action.admin.indices.refresh.TransportRefreshAction;
import org.elasticsearch.action.admin.indices.reloadanalyzer.ReloadAnalyzerAction;
import org.elasticsearch.action.admin.indices.reloadanalyzer.TransportReloadAnalyzersAction;
import org.elasticsearch.action.admin.indices.rollover.RolloverAction;
import org.elasticsearch.action.admin.indices.rollover.TransportRolloverAction;
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsAction;
Expand Down Expand Up @@ -277,7 +275,6 @@
import org.elasticsearch.rest.action.admin.indices.RestPutMappingAction;
import org.elasticsearch.rest.action.admin.indices.RestRecoveryAction;
import org.elasticsearch.rest.action.admin.indices.RestRefreshAction;
import org.elasticsearch.rest.action.admin.indices.RestReloadAnalyzersAction;
import org.elasticsearch.rest.action.admin.indices.RestResizeHandler;
import org.elasticsearch.rest.action.admin.indices.RestRolloverIndexAction;
import org.elasticsearch.rest.action.admin.indices.RestSyncedFlushAction;
Expand Down Expand Up @@ -502,7 +499,6 @@ public <Request extends ActionRequest, Response extends ActionResponse> void reg
actions.register(ClearScrollAction.INSTANCE, TransportClearScrollAction.class);
actions.register(RecoveryAction.INSTANCE, TransportRecoveryAction.class);
actions.register(NodesReloadSecureSettingsAction.INSTANCE, TransportNodesReloadSecureSettingsAction.class);
actions.register(ReloadAnalyzerAction.INSTANCE, TransportReloadAnalyzersAction.class);

//Indexed scripts
actions.register(PutStoredScriptAction.INSTANCE, TransportPutStoredScriptAction.class);
Expand Down Expand Up @@ -600,7 +596,6 @@ public void initRestHandlers(Supplier<DiscoveryNodes> nodesInCluster) {
registerHandler.accept(new RestGetFieldMappingAction(settings, restController));

registerHandler.accept(new RestRefreshAction(settings, restController));
registerHandler.accept(new RestReloadAnalyzersAction(settings, restController));
registerHandler.accept(new RestFlushAction(settings, restController));
registerHandler.accept(new RestSyncedFlushAction(settings, restController));
registerHandler.accept(new RestForceMergeAction(settings, restController));
Expand Down

This file was deleted.

This file was deleted.

Expand Up @@ -68,9 +68,6 @@
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequestBuilder;
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
import org.elasticsearch.action.admin.indices.reloadanalyzer.ReloadAnalyzerRequestBuilder;
import org.elasticsearch.action.admin.indices.reloadanalyzer.ReloadAnalyzersRequest;
import org.elasticsearch.action.admin.indices.reloadanalyzer.ReloadAnalyzersResponse;
import org.elasticsearch.action.admin.indices.rollover.RolloverRequest;
import org.elasticsearch.action.admin.indices.rollover.RolloverRequestBuilder;
import org.elasticsearch.action.admin.indices.rollover.RolloverResponse;
Expand Down Expand Up @@ -742,18 +739,4 @@ public interface IndicesAdminClient extends ElasticsearchClient {
*/
void rolloverIndex(RolloverRequest request, ActionListener<RolloverResponse> listener);

/**
* Reloads analyzers of one or more indices.
*/
ActionFuture<ReloadAnalyzersResponse> reloadAnalyzers(ReloadAnalyzersRequest request);

/**
* Reloads analyzers of one or more indices.
*/
void reloadAnalyzers(ReloadAnalyzersRequest request, ActionListener<ReloadAnalyzersResponse> listener);

/**
* Reloads analyzers of one or more indices.
*/
ReloadAnalyzerRequestBuilder prepareReloadAnalyzers(String... indices);
}
11 changes: 0 additions & 11 deletions server/src/main/java/org/elasticsearch/client/Requests.java
Expand Up @@ -51,7 +51,6 @@
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest;
import org.elasticsearch.action.admin.indices.open.OpenIndexRequest;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.admin.indices.reloadanalyzer.ReloadAnalyzersRequest;
import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsRequest;
import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest;
import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresRequest;
Expand Down Expand Up @@ -524,14 +523,4 @@ public static DeleteSnapshotRequest deleteSnapshotRequest(String repository, Str
public static SnapshotsStatusRequest snapshotsStatusRequest(String repository) {
return new SnapshotsStatusRequest(repository);
}

/**
* A request to reload search Analyzers indices settings.
*
* @param indices The indices to update the settings for. Use {@code null} or {@code _all} to executed against all indices.
* @return The request
*/
public static ReloadAnalyzersRequest reloadAnalyzersRequest(String... indices) {
return new ReloadAnalyzersRequest(indices);
}
}
Expand Up @@ -194,10 +194,6 @@
import org.elasticsearch.action.admin.indices.refresh.RefreshRequest;
import org.elasticsearch.action.admin.indices.refresh.RefreshRequestBuilder;
import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
import org.elasticsearch.action.admin.indices.reloadanalyzer.ReloadAnalyzerAction;
import org.elasticsearch.action.admin.indices.reloadanalyzer.ReloadAnalyzerRequestBuilder;
import org.elasticsearch.action.admin.indices.reloadanalyzer.ReloadAnalyzersRequest;
import org.elasticsearch.action.admin.indices.reloadanalyzer.ReloadAnalyzersResponse;
import org.elasticsearch.action.admin.indices.rollover.RolloverAction;
import org.elasticsearch.action.admin.indices.rollover.RolloverRequest;
import org.elasticsearch.action.admin.indices.rollover.RolloverRequestBuilder;
Expand Down Expand Up @@ -1461,11 +1457,6 @@ public RefreshRequestBuilder prepareRefresh(String... indices) {
return new RefreshRequestBuilder(this, RefreshAction.INSTANCE).setIndices(indices);
}

@Override
public ReloadAnalyzerRequestBuilder prepareReloadAnalyzers(String... indices) {
return new ReloadAnalyzerRequestBuilder(this, ReloadAnalyzerAction.INSTANCE).setIndices(indices);
}

@Override
public ActionFuture<IndicesStatsResponse> stats(final IndicesStatsRequest request) {
return execute(IndicesStatsAction.INSTANCE, request);
Expand Down Expand Up @@ -1671,16 +1662,6 @@ public ActionFuture<GetSettingsResponse> getSettings(GetSettingsRequest request)
public void getSettings(GetSettingsRequest request, ActionListener<GetSettingsResponse> listener) {
execute(GetSettingsAction.INSTANCE, request, listener);
}

@Override
public ActionFuture<ReloadAnalyzersResponse> reloadAnalyzers(ReloadAnalyzersRequest request) {
return execute(ReloadAnalyzerAction.INSTANCE, request);
}

@Override
public void reloadAnalyzers(final ReloadAnalyzersRequest request, final ActionListener<ReloadAnalyzersResponse> listener) {
execute(ReloadAnalyzerAction.INSTANCE, request, listener);
}
}

@Override
Expand Down

This file was deleted.

Expand Up @@ -20,8 +20,8 @@
package org.elasticsearch.action.admin.indices.cache.clear;

import org.elasticsearch.action.support.DefaultShardOperationFailedException;
import org.elasticsearch.action.support.broadcast.AbstractBroadcastResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractBroadcastResponseTestCase;

import java.util.List;

Expand Down
Expand Up @@ -20,8 +20,8 @@
package org.elasticsearch.action.admin.indices.flush;

import org.elasticsearch.action.support.DefaultShardOperationFailedException;
import org.elasticsearch.action.support.broadcast.AbstractBroadcastResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractBroadcastResponseTestCase;

import java.util.List;

Expand Down
Expand Up @@ -20,8 +20,8 @@
package org.elasticsearch.action.admin.indices.forcemerge;

import org.elasticsearch.action.support.DefaultShardOperationFailedException;
import org.elasticsearch.action.support.broadcast.AbstractBroadcastResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractBroadcastResponseTestCase;

import java.util.List;

Expand Down
Expand Up @@ -20,8 +20,8 @@
package org.elasticsearch.action.admin.indices.refresh;

import org.elasticsearch.action.support.DefaultShardOperationFailedException;
import org.elasticsearch.action.support.broadcast.AbstractBroadcastResponseTestCase;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractBroadcastResponseTestCase;

import java.util.List;

Expand Down
Expand Up @@ -21,9 +21,9 @@

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.support.DefaultShardOperationFailedException;
import org.elasticsearch.action.support.broadcast.AbstractBroadcastResponseTestCase;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.test.AbstractBroadcastResponseTestCase;

import java.io.IOException;
import java.util.ArrayList;
Expand Down
Expand Up @@ -17,10 +17,11 @@
* under the License.
*/

package org.elasticsearch.action.support.broadcast;
package org.elasticsearch.test;

import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.support.DefaultShardOperationFailedException;
import org.elasticsearch.action.support.broadcast.BroadcastResponse;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.xcontent.ToXContent;
Expand Down
Expand Up @@ -57,14 +57,17 @@
import org.elasticsearch.snapshots.SourceOnlySnapshotRepository;
import org.elasticsearch.threadpool.ThreadPool;
import org.elasticsearch.watcher.ResourceWatcherService;
import org.elasticsearch.xpack.core.action.ReloadAnalyzerAction;
import org.elasticsearch.xpack.core.action.TransportFreezeIndexAction;
import org.elasticsearch.xpack.core.action.TransportReloadAnalyzersAction;
import org.elasticsearch.xpack.core.action.TransportXPackInfoAction;
import org.elasticsearch.xpack.core.action.TransportXPackUsageAction;
import org.elasticsearch.xpack.core.action.XPackInfoAction;
import org.elasticsearch.xpack.core.action.XPackUsageAction;
import org.elasticsearch.xpack.core.action.XPackUsageResponse;
import org.elasticsearch.xpack.core.ml.MlMetadata;
import org.elasticsearch.xpack.core.rest.action.RestFreezeIndexAction;
import org.elasticsearch.xpack.core.rest.action.RestReloadAnalyzersAction;
import org.elasticsearch.xpack.core.rest.action.RestXPackInfoAction;
import org.elasticsearch.xpack.core.rest.action.RestXPackUsageAction;
import org.elasticsearch.xpack.core.security.authc.TokenMetaData;
Expand Down Expand Up @@ -259,6 +262,7 @@ public Collection<Object> createComponents(Client client, ClusterService cluster
actions.add(new ActionHandler<>(TransportFreezeIndexAction.FreezeIndexAction.INSTANCE,
TransportFreezeIndexAction.class));
actions.addAll(licensing.getActions());
actions.add(new ActionHandler<>(ReloadAnalyzerAction.INSTANCE, TransportReloadAnalyzersAction.class));
return actions;
}

Expand Down Expand Up @@ -295,6 +299,7 @@ public List<RestHandler> getRestHandlers(Settings settings, RestController restC
handlers.add(new RestXPackInfoAction(settings, restController));
handlers.add(new RestXPackUsageAction(settings, restController));
handlers.add(new RestFreezeIndexAction(settings, restController));
handlers.add(new RestReloadAnalyzersAction(settings, restController));
handlers.addAll(licensing.getRestHandlers(settings, restController, clusterSettings, indexScopedSettings, settingsFilter,
indexNameExpressionResolver, nodesInCluster));
return handlers;
Expand Down
@@ -0,0 +1,23 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.core.action;

import org.elasticsearch.action.Action;

public class ReloadAnalyzerAction extends Action<ReloadAnalyzersResponse> {

public static final ReloadAnalyzerAction INSTANCE = new ReloadAnalyzerAction();
public static final String NAME = "indices:admin/reload_analyzers";

private ReloadAnalyzerAction() {
super(NAME);
}

@Override
public ReloadAnalyzersResponse newResponse() {
return new ReloadAnalyzersResponse();
}
}

0 comments on commit d92da88

Please sign in to comment.