Skip to content

Commit 67c2868

Browse files
committed
Remove RestGetAllMappingsAction (#31129)
We currently have a specific REST action to retrieve all indices and types mappings, which used internally the get index API. This doesn't seem to be required anymore though as the existing RestGetMappingAction could as well take the requests with no indices and types specified. This commit removes the RestGetAllMappingsAction in favour of using RestGetMappingAction also for requests that don't specify indices nor types.
1 parent 10e2013 commit 67c2868

File tree

3 files changed

+7
-119
lines changed

3 files changed

+7
-119
lines changed

server/src/main/java/org/elasticsearch/action/ActionModule.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,10 @@
206206
import org.elasticsearch.common.settings.Settings;
207207
import org.elasticsearch.common.settings.SettingsFilter;
208208
import org.elasticsearch.indices.breaker.CircuitBreakerService;
209+
import org.elasticsearch.persistent.CompletionPersistentTaskAction;
210+
import org.elasticsearch.persistent.RemovePersistentTaskAction;
211+
import org.elasticsearch.persistent.StartPersistentTaskAction;
212+
import org.elasticsearch.persistent.UpdatePersistentTaskStatusAction;
209213
import org.elasticsearch.plugins.ActionPlugin;
210214
import org.elasticsearch.plugins.ActionPlugin.ActionHandler;
211215
import org.elasticsearch.rest.RestController;
@@ -241,7 +245,6 @@
241245
import org.elasticsearch.rest.action.admin.cluster.RestRestoreSnapshotAction;
242246
import org.elasticsearch.rest.action.admin.cluster.RestSnapshotsStatusAction;
243247
import org.elasticsearch.rest.action.admin.cluster.RestVerifyRepositoryAction;
244-
import org.elasticsearch.rest.action.admin.indices.RestResizeHandler;
245248
import org.elasticsearch.rest.action.admin.indices.RestAnalyzeAction;
246249
import org.elasticsearch.rest.action.admin.indices.RestClearIndicesCacheAction;
247250
import org.elasticsearch.rest.action.admin.indices.RestCloseIndexAction;
@@ -252,7 +255,6 @@
252255
import org.elasticsearch.rest.action.admin.indices.RestForceMergeAction;
253256
import org.elasticsearch.rest.action.admin.indices.RestGetAliasesAction;
254257
import org.elasticsearch.rest.action.admin.indices.RestGetAllAliasesAction;
255-
import org.elasticsearch.rest.action.admin.indices.RestGetAllMappingsAction;
256258
import org.elasticsearch.rest.action.admin.indices.RestGetFieldMappingAction;
257259
import org.elasticsearch.rest.action.admin.indices.RestGetIndexTemplateAction;
258260
import org.elasticsearch.rest.action.admin.indices.RestGetIndicesAction;
@@ -269,6 +271,7 @@
269271
import org.elasticsearch.rest.action.admin.indices.RestPutMappingAction;
270272
import org.elasticsearch.rest.action.admin.indices.RestRecoveryAction;
271273
import org.elasticsearch.rest.action.admin.indices.RestRefreshAction;
274+
import org.elasticsearch.rest.action.admin.indices.RestResizeHandler;
272275
import org.elasticsearch.rest.action.admin.indices.RestRolloverIndexAction;
273276
import org.elasticsearch.rest.action.admin.indices.RestSyncedFlushAction;
274277
import org.elasticsearch.rest.action.admin.indices.RestUpdateSettingsAction;
@@ -313,10 +316,6 @@
313316
import org.elasticsearch.rest.action.search.RestSearchScrollAction;
314317
import org.elasticsearch.threadpool.ThreadPool;
315318
import org.elasticsearch.usage.UsageService;
316-
import org.elasticsearch.persistent.CompletionPersistentTaskAction;
317-
import org.elasticsearch.persistent.RemovePersistentTaskAction;
318-
import org.elasticsearch.persistent.StartPersistentTaskAction;
319-
import org.elasticsearch.persistent.UpdatePersistentTaskStatusAction;
320319

321320
import java.util.ArrayList;
322321
import java.util.Collections;
@@ -556,7 +555,6 @@ public void initRestHandlers(Supplier<DiscoveryNodes> nodesInCluster) {
556555
registerHandler.accept(new RestSnapshotsStatusAction(settings, restController));
557556

558557
registerHandler.accept(new RestGetAllAliasesAction(settings, restController));
559-
registerHandler.accept(new RestGetAllMappingsAction(settings, restController));
560558
registerHandler.accept(new RestGetIndicesAction(settings, restController, indexScopedSettings, settingsFilter));
561559
registerHandler.accept(new RestIndicesStatsAction(settings, restController));
562560
registerHandler.accept(new RestIndicesSegmentsAction(settings, restController));

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAllMappingsAction.java

Lines changed: 0 additions & 109 deletions
This file was deleted.

server/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
package org.elasticsearch.rest.action.admin.indices;
2121

2222
import com.carrotsearch.hppc.cursors.ObjectCursor;
23-
import com.carrotsearch.hppc.cursors.ObjectObjectCursor;
24-
2523
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest;
2624
import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse;
2725
import org.elasticsearch.action.support.IndicesOptions;
@@ -56,12 +54,13 @@
5654

5755
import static org.elasticsearch.rest.RestRequest.Method.GET;
5856
import static org.elasticsearch.rest.RestRequest.Method.HEAD;
59-
import static org.elasticsearch.rest.RestStatus.OK;
6057

6158
public class RestGetMappingAction extends BaseRestHandler {
6259

6360
public RestGetMappingAction(final Settings settings, final RestController controller) {
6461
super(settings);
62+
controller.registerHandler(GET, "/_mapping", this);
63+
controller.registerHandler(GET, "/_mappings", this);
6564
controller.registerHandler(GET, "/{index}/{type}/_mapping", this);
6665
controller.registerHandler(GET, "/{index}/_mappings", this);
6766
controller.registerHandler(GET, "/{index}/_mapping", this);

0 commit comments

Comments
 (0)