From ad028f3f9c8b4a5777026174668d7aef77daad59 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Thu, 28 Jul 2016 17:32:05 -0400 Subject: [PATCH] Squash o.e.rest.action.admin.indices In an effort to reduce the number of tiny packages we have in the code base this moves all the files that were in subdirectories of `org.elasticsearch.rest.action.admin.indices` into `org.elasticsearch.rest.action.admin.indices`. It also adds a `package-info.java` file explaining what the files in the package *do*. Also fixes line length in these packages. It makes a single non-checkstyle change: implementing `ToXContent` on `GetIndexTemplatesResponse`. I did this because it was the right thing to do and it fixed a line length violation. --- .../resources/checkstyle_suppressions.xml | 14 ---- .../elasticsearch/ElasticsearchException.java | 4 +- .../elasticsearch/action/ActionModule.java | 66 +++++++++---------- .../alias/TransportIndicesAliasesAction.java | 2 +- .../admin/indices/get/GetIndexRequest.java | 8 --- .../get/GetIndexTemplatesResponse.java | 21 ++++-- .../health/RestClusterHealthAction.java | 6 +- .../delete => }/AliasesNotFoundException.java | 2 +- .../head => }/RestAliasesExistAction.java | 2 +- .../{analyze => }/RestAnalyzeAction.java | 23 ++++--- .../RestClearIndicesCacheAction.java | 11 ++-- .../{close => }/RestCloseIndexAction.java | 2 +- .../{create => }/RestCreateIndexAction.java | 2 +- .../{delete => }/RestDeleteIndexAction.java | 2 +- .../RestDeleteIndexTemplateAction.java | 8 +-- .../indices/{flush => }/RestFlushAction.java | 2 +- .../RestForceMergeAction.java | 2 +- .../{alias/get => }/RestGetAliasesAction.java | 2 +- .../get => }/RestGetFieldMappingAction.java | 8 +-- .../get => }/RestGetIndexTemplateAction.java | 35 ++-------- .../{get => }/RestGetIndicesAction.java | 17 +++-- .../get => }/RestGetMappingAction.java | 4 +- .../{settings => }/RestGetSettingsAction.java | 5 +- .../RestHeadIndexTemplateAction.java | 2 +- .../RestIndexDeleteAliasesAction.java | 2 +- .../put => }/RestIndexPutAliasAction.java | 10 +-- .../{alias => }/RestIndicesAliasesAction.java | 11 ++-- .../indices => }/RestIndicesExistsAction.java | 2 +- .../RestIndicesSegmentsAction.java | 7 +- .../RestIndicesShardStoresAction.java | 5 +- .../{stats => }/RestIndicesStatsAction.java | 10 +-- .../{open => }/RestOpenIndexAction.java | 2 +- .../put => }/RestPutIndexTemplateAction.java | 2 +- .../put => }/RestPutMappingAction.java | 2 +- .../{recovery => }/RestRecoveryAction.java | 2 +- .../{refresh => }/RestRefreshAction.java | 2 +- .../{flush => }/RestSyncedFlushAction.java | 2 +- .../types => }/RestTypesExistsAction.java | 2 +- .../RestUpdateSettingsAction.java | 2 +- .../{upgrade => }/RestUpgradeAction.java | 3 +- .../query => }/RestValidateQueryAction.java | 5 +- .../action/admin/indices/package-info.java | 24 +++++++ .../ExceptionSerializationTests.java | 4 +- .../elasticsearch/aliases/IndexAliasesIT.java | 2 +- .../{analyze => }/RestAnalyzeActionTests.java | 3 +- 45 files changed, 166 insertions(+), 188 deletions(-) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{alias/delete => }/AliasesNotFoundException.java (95%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{alias/head => }/RestAliasesExistAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{analyze => }/RestAnalyzeAction.java (93%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{cache/clear => }/RestClearIndicesCacheAction.java (95%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{close => }/RestCloseIndexAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{create => }/RestCreateIndexAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{delete => }/RestDeleteIndexAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{template/delete => }/RestDeleteIndexTemplateAction.java (88%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{flush => }/RestFlushAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{forcemerge => }/RestForceMergeAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{alias/get => }/RestGetAliasesAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{mapping/get => }/RestGetFieldMappingAction.java (96%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{template/get => }/RestGetIndexTemplateAction.java (64%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{get => }/RestGetIndicesAction.java (95%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{mapping/get => }/RestGetMappingAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{settings => }/RestGetSettingsAction.java (96%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{template/head => }/RestHeadIndexTemplateAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{alias/delete => }/RestIndexDeleteAliasesAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{alias/put => }/RestIndexPutAliasAction.java (94%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{alias => }/RestIndicesAliasesAction.java (95%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{exists/indices => }/RestIndicesExistsAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{segments => }/RestIndicesSegmentsAction.java (95%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{shards => }/RestIndicesShardStoresAction.java (95%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{stats => }/RestIndicesStatsAction.java (93%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{open => }/RestOpenIndexAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{template/put => }/RestPutIndexTemplateAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{mapping/put => }/RestPutMappingAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{recovery => }/RestRecoveryAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{refresh => }/RestRefreshAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{flush => }/RestSyncedFlushAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{exists/types => }/RestTypesExistsAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{settings => }/RestUpdateSettingsAction.java (98%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{upgrade => }/RestUpgradeAction.java (97%) rename core/src/main/java/org/elasticsearch/rest/action/admin/indices/{validate/query => }/RestValidateQueryAction.java (96%) create mode 100644 core/src/main/java/org/elasticsearch/rest/action/admin/indices/package-info.java rename core/src/test/java/org/elasticsearch/rest/action/admin/indices/{analyze => }/RestAnalyzeActionTests.java (98%) diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index 339abc8c02d..05351b0f8e2 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -507,26 +507,12 @@ - - - - - - - - - - - - - - diff --git a/core/src/main/java/org/elasticsearch/ElasticsearchException.java b/core/src/main/java/org/elasticsearch/ElasticsearchException.java index c6cfb9e9a02..93576c790c4 100644 --- a/core/src/main/java/org/elasticsearch/ElasticsearchException.java +++ b/core/src/main/java/org/elasticsearch/ElasticsearchException.java @@ -638,8 +638,8 @@ public class ElasticsearchException extends RuntimeException implements ToXConte org.elasticsearch.common.settings.NoClassSettingsException::new, 111), BIND_TRANSPORT_EXCEPTION(org.elasticsearch.transport.BindTransportException.class, org.elasticsearch.transport.BindTransportException::new, 112), - ALIASES_NOT_FOUND_EXCEPTION(org.elasticsearch.rest.action.admin.indices.alias.delete.AliasesNotFoundException.class, - org.elasticsearch.rest.action.admin.indices.alias.delete.AliasesNotFoundException::new, 113), + ALIASES_NOT_FOUND_EXCEPTION(org.elasticsearch.rest.action.admin.indices.AliasesNotFoundException.class, + org.elasticsearch.rest.action.admin.indices.AliasesNotFoundException::new, 113), INDEX_SHARD_RECOVERING_EXCEPTION(org.elasticsearch.index.shard.IndexShardRecoveringException.class, org.elasticsearch.index.shard.IndexShardRecoveringException::new, 114), TRANSLOG_EXCEPTION(org.elasticsearch.index.translog.TranslogException.class, diff --git a/core/src/main/java/org/elasticsearch/action/ActionModule.java b/core/src/main/java/org/elasticsearch/action/ActionModule.java index 3d5e29e7e7f..83c3ec712b9 100644 --- a/core/src/main/java/org/elasticsearch/action/ActionModule.java +++ b/core/src/main/java/org/elasticsearch/action/ActionModule.java @@ -236,41 +236,41 @@ import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestDeleteStore import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestGetStoredScriptAction; import org.elasticsearch.rest.action.admin.cluster.storedscripts.RestPutStoredScriptAction; import org.elasticsearch.rest.action.admin.cluster.tasks.RestPendingClusterTasksAction; +import org.elasticsearch.rest.action.admin.indices.RestAliasesExistAction; +import org.elasticsearch.rest.action.admin.indices.RestAnalyzeAction; +import org.elasticsearch.rest.action.admin.indices.RestClearIndicesCacheAction; +import org.elasticsearch.rest.action.admin.indices.RestCloseIndexAction; +import org.elasticsearch.rest.action.admin.indices.RestCreateIndexAction; +import org.elasticsearch.rest.action.admin.indices.RestDeleteIndexAction; +import org.elasticsearch.rest.action.admin.indices.RestDeleteIndexTemplateAction; +import org.elasticsearch.rest.action.admin.indices.RestFlushAction; +import org.elasticsearch.rest.action.admin.indices.RestForceMergeAction; +import org.elasticsearch.rest.action.admin.indices.RestGetAliasesAction; +import org.elasticsearch.rest.action.admin.indices.RestGetFieldMappingAction; +import org.elasticsearch.rest.action.admin.indices.RestGetIndexTemplateAction; +import org.elasticsearch.rest.action.admin.indices.RestGetIndicesAction; +import org.elasticsearch.rest.action.admin.indices.RestGetMappingAction; +import org.elasticsearch.rest.action.admin.indices.RestGetSettingsAction; +import org.elasticsearch.rest.action.admin.indices.RestHeadIndexTemplateAction; +import org.elasticsearch.rest.action.admin.indices.RestIndexDeleteAliasesAction; +import org.elasticsearch.rest.action.admin.indices.RestIndexPutAliasAction; +import org.elasticsearch.rest.action.admin.indices.RestIndicesAliasesAction; +import org.elasticsearch.rest.action.admin.indices.RestIndicesExistsAction; +import org.elasticsearch.rest.action.admin.indices.RestIndicesSegmentsAction; +import org.elasticsearch.rest.action.admin.indices.RestIndicesShardStoresAction; +import org.elasticsearch.rest.action.admin.indices.RestIndicesStatsAction; +import org.elasticsearch.rest.action.admin.indices.RestOpenIndexAction; +import org.elasticsearch.rest.action.admin.indices.RestPutIndexTemplateAction; +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.RestRolloverIndexAction; import org.elasticsearch.rest.action.admin.indices.RestShrinkIndexAction; -import org.elasticsearch.rest.action.admin.indices.alias.RestIndicesAliasesAction; -import org.elasticsearch.rest.action.admin.indices.alias.delete.RestIndexDeleteAliasesAction; -import org.elasticsearch.rest.action.admin.indices.alias.get.RestGetAliasesAction; -import org.elasticsearch.rest.action.admin.indices.alias.head.RestAliasesExistAction; -import org.elasticsearch.rest.action.admin.indices.alias.put.RestIndexPutAliasAction; -import org.elasticsearch.rest.action.admin.indices.analyze.RestAnalyzeAction; -import org.elasticsearch.rest.action.admin.indices.cache.clear.RestClearIndicesCacheAction; -import org.elasticsearch.rest.action.admin.indices.close.RestCloseIndexAction; -import org.elasticsearch.rest.action.admin.indices.create.RestCreateIndexAction; -import org.elasticsearch.rest.action.admin.indices.delete.RestDeleteIndexAction; -import org.elasticsearch.rest.action.admin.indices.exists.indices.RestIndicesExistsAction; -import org.elasticsearch.rest.action.admin.indices.exists.types.RestTypesExistsAction; -import org.elasticsearch.rest.action.admin.indices.flush.RestFlushAction; -import org.elasticsearch.rest.action.admin.indices.flush.RestSyncedFlushAction; -import org.elasticsearch.rest.action.admin.indices.forcemerge.RestForceMergeAction; -import org.elasticsearch.rest.action.admin.indices.get.RestGetIndicesAction; -import org.elasticsearch.rest.action.admin.indices.mapping.get.RestGetFieldMappingAction; -import org.elasticsearch.rest.action.admin.indices.mapping.get.RestGetMappingAction; -import org.elasticsearch.rest.action.admin.indices.mapping.put.RestPutMappingAction; -import org.elasticsearch.rest.action.admin.indices.open.RestOpenIndexAction; -import org.elasticsearch.rest.action.admin.indices.recovery.RestRecoveryAction; -import org.elasticsearch.rest.action.admin.indices.refresh.RestRefreshAction; -import org.elasticsearch.rest.action.admin.indices.segments.RestIndicesSegmentsAction; -import org.elasticsearch.rest.action.admin.indices.settings.RestGetSettingsAction; -import org.elasticsearch.rest.action.admin.indices.settings.RestUpdateSettingsAction; -import org.elasticsearch.rest.action.admin.indices.shards.RestIndicesShardStoresAction; -import org.elasticsearch.rest.action.admin.indices.stats.RestIndicesStatsAction; -import org.elasticsearch.rest.action.admin.indices.template.delete.RestDeleteIndexTemplateAction; -import org.elasticsearch.rest.action.admin.indices.template.get.RestGetIndexTemplateAction; -import org.elasticsearch.rest.action.admin.indices.template.head.RestHeadIndexTemplateAction; -import org.elasticsearch.rest.action.admin.indices.template.put.RestPutIndexTemplateAction; -import org.elasticsearch.rest.action.admin.indices.upgrade.RestUpgradeAction; -import org.elasticsearch.rest.action.admin.indices.validate.query.RestValidateQueryAction; +import org.elasticsearch.rest.action.admin.indices.RestSyncedFlushAction; +import org.elasticsearch.rest.action.admin.indices.RestTypesExistsAction; +import org.elasticsearch.rest.action.admin.indices.RestUpdateSettingsAction; +import org.elasticsearch.rest.action.admin.indices.RestUpgradeAction; +import org.elasticsearch.rest.action.admin.indices.RestValidateQueryAction; import org.elasticsearch.rest.action.bulk.RestBulkAction; import org.elasticsearch.rest.action.cat.AbstractCatAction; import org.elasticsearch.rest.action.cat.RestAliasAction; diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java b/core/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java index 3ae7d7ebb7c..6b44609fe12 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/alias/TransportIndicesAliasesAction.java @@ -33,7 +33,7 @@ import org.elasticsearch.cluster.metadata.MetaDataIndexAliasesService; import org.elasticsearch.cluster.service.ClusterService; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.rest.action.admin.indices.alias.delete.AliasesNotFoundException; +import org.elasticsearch.rest.action.admin.indices.AliasesNotFoundException; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequest.java b/core/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequest.java index 80ce5050f0a..68878579259 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequest.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/get/GetIndexRequest.java @@ -121,14 +121,6 @@ public class GetIndexRequest extends ClusterInfoRequest { return features; } - /** - * @deprecated use {@link #features()} instead - */ - @Deprecated - public Feature[] featuresAsEnums() { - return features(); - } - @Override public ActionRequestValidationException validate() { return null; diff --git a/core/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java b/core/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java index dfe99852dce..7693419df43 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/indices/template/get/GetIndexTemplatesResponse.java @@ -22,15 +22,18 @@ import org.elasticsearch.action.ActionResponse; import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; +import org.elasticsearch.common.xcontent.ToXContent; +import org.elasticsearch.common.xcontent.XContentBuilder; import java.io.IOException; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; -/** - * - */ -public class GetIndexTemplatesResponse extends ActionResponse { +import static java.util.Collections.singletonMap; + +public class GetIndexTemplatesResponse extends ActionResponse implements ToXContent { private List indexTemplates; @@ -63,4 +66,14 @@ public class GetIndexTemplatesResponse extends ActionResponse { indexTemplate.writeTo(out); } } + + @Override + public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException { + params = new ToXContent.DelegatingMapParams(singletonMap("reduce_mappings", "true"), params); + + for (IndexTemplateMetaData indexTemplateMetaData : getIndexTemplates()) { + IndexTemplateMetaData.Builder.toXContent(indexTemplateMetaData, builder, params); + } + return builder; + } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java index c7566d5d5f6..6082b60443d 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/health/RestClusterHealthAction.java @@ -37,9 +37,6 @@ import java.util.Locale; import static org.elasticsearch.client.Requests.clusterHealthRequest; -/** - * - */ public class RestClusterHealthAction extends BaseRestHandler { @Inject @@ -60,7 +57,8 @@ public class RestClusterHealthAction extends BaseRestHandler { if (waitForStatus != null) { clusterHealthRequest.waitForStatus(ClusterHealthStatus.valueOf(waitForStatus.toUpperCase(Locale.ROOT))); } - clusterHealthRequest.waitForRelocatingShards(request.paramAsInt("wait_for_relocating_shards", clusterHealthRequest.waitForRelocatingShards())); + clusterHealthRequest.waitForRelocatingShards( + request.paramAsInt("wait_for_relocating_shards", clusterHealthRequest.waitForRelocatingShards())); clusterHealthRequest.waitForActiveShards(request.paramAsInt("wait_for_active_shards", clusterHealthRequest.waitForActiveShards())); clusterHealthRequest.waitForNodes(request.param("wait_for_nodes", clusterHealthRequest.waitForNodes())); if (request.param("wait_for_events") != null) { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/delete/AliasesNotFoundException.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/AliasesNotFoundException.java similarity index 95% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/delete/AliasesNotFoundException.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/AliasesNotFoundException.java index 6e183786df1..0b60a5c249c 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/delete/AliasesNotFoundException.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/AliasesNotFoundException.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.indices.alias.delete; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.ResourceNotFoundException; import org.elasticsearch.common.io.stream.StreamInput; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/head/RestAliasesExistAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAliasesExistAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/head/RestAliasesExistAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAliasesExistAction.java index 54f9a649168..dbb8ddde9d1 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/head/RestAliasesExistAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAliasesExistAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.alias.head; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.ExceptionsHelper; import org.elasticsearch.action.ActionListener; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java similarity index 93% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java index 30fadf028bc..d1bc3e581c9 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java @@ -16,10 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.indices.analyze; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest; -import org.elasticsearch.action.admin.indices.analyze.AnalyzeResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.ParseFieldMatcher; @@ -27,7 +26,6 @@ import org.elasticsearch.common.Strings; import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; @@ -41,14 +39,10 @@ import org.elasticsearch.rest.action.support.RestToXContentListener; import java.io.IOException; import java.util.ArrayList; import java.util.List; -import java.util.function.Consumer; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; -/** - * - */ public class RestAnalyzeAction extends BaseRestHandler { public static class Fields { @@ -141,24 +135,28 @@ public class RestAnalyzeAction extends BaseRestHandler { } else { throw new IllegalArgumentException(currentFieldName + " should be tokenizer's name or setting"); } - } else if (parseFieldMatcher.match(currentFieldName, Fields.TOKEN_FILTERS) && token == XContentParser.Token.START_ARRAY) { + } else if (parseFieldMatcher.match(currentFieldName, Fields.TOKEN_FILTERS) + && token == XContentParser.Token.START_ARRAY) { while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token == XContentParser.Token.VALUE_STRING) { analyzeRequest.addTokenFilter(parser.text()); } else if (token == XContentParser.Token.START_OBJECT) { analyzeRequest.addTokenFilter(parser.map()); } else { - throw new IllegalArgumentException(currentFieldName + " array element should contain token_filter's name or setting"); + throw new IllegalArgumentException(currentFieldName + + " array element should contain token_filter's name or setting"); } } - } else if (parseFieldMatcher.match(currentFieldName, Fields.CHAR_FILTERS) && token == XContentParser.Token.START_ARRAY) { + } else if (parseFieldMatcher.match(currentFieldName, Fields.CHAR_FILTERS) + && token == XContentParser.Token.START_ARRAY) { while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { if (token == XContentParser.Token.VALUE_STRING) { analyzeRequest.addCharFilter(parser.text()); } else if (token == XContentParser.Token.START_OBJECT) { analyzeRequest.addCharFilter(parser.map()); } else { - throw new IllegalArgumentException(currentFieldName + " array element should contain char filter's name or setting"); + throw new IllegalArgumentException(currentFieldName + + " array element should contain char filter's name or setting"); } } } else if (parseFieldMatcher.match(currentFieldName, Fields.EXPLAIN)) { @@ -177,7 +175,8 @@ public class RestAnalyzeAction extends BaseRestHandler { } analyzeRequest.attributes(attributes.toArray(new String[attributes.size()])); } else { - throw new IllegalArgumentException("Unknown parameter [" + currentFieldName + "] in request body or parameter is of the wrong type[" + token + "] "); + throw new IllegalArgumentException("Unknown parameter [" + + currentFieldName + "] in request body or parameter is of the wrong type[" + token + "] "); } } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java similarity index 95% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java index 454e18cb2d7..8f2411ff87c 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/cache/clear/RestClearIndicesCacheAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.cache.clear; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheRequest; import org.elasticsearch.action.admin.indices.cache.clear.ClearIndicesCacheResponse; @@ -44,9 +44,6 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; -/** - * - */ public class RestClearIndicesCacheAction extends BaseRestHandler { @Inject @@ -61,7 +58,8 @@ public class RestClearIndicesCacheAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) { - ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest(Strings.splitStringByCommaToArray(request.param("index"))); + ClearIndicesCacheRequest clearIndicesCacheRequest = new ClearIndicesCacheRequest( + Strings.splitStringByCommaToArray(request.param("index"))); clearIndicesCacheRequest.indicesOptions(IndicesOptions.fromRequest(request, clearIndicesCacheRequest.indicesOptions())); fromRequest(request, clearIndicesCacheRequest, parseFieldMatcher); client.admin().indices().clearCache(clearIndicesCacheRequest, new RestBuilderListener(channel) { @@ -80,7 +78,8 @@ public class RestClearIndicesCacheAction extends BaseRestHandler { return false; } - public static ClearIndicesCacheRequest fromRequest(final RestRequest request, ClearIndicesCacheRequest clearIndicesCacheRequest, ParseFieldMatcher parseFieldMatcher) { + public static ClearIndicesCacheRequest fromRequest(final RestRequest request, ClearIndicesCacheRequest clearIndicesCacheRequest, + ParseFieldMatcher parseFieldMatcher) { for (Map.Entry entry : request.params().entrySet()) { if (parseFieldMatcher.match(entry.getKey(), Fields.QUERY)) { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java index 1022310a350..87688d0c73f 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/close/RestCloseIndexAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.close; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.close.CloseIndexRequest; import org.elasticsearch.action.admin.indices.close.CloseIndexResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java index bc45093e4bc..a4c2356e414 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/create/RestCreateIndexAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.create; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.create.CreateIndexRequest; import org.elasticsearch.action.admin.indices.create.CreateIndexResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java index 75564021a3b..5547141b4fc 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/delete/RestDeleteIndexAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.delete; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; import org.elasticsearch.action.admin.indices.delete.DeleteIndexResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java similarity index 88% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java index 00a029c34b9..193d149f4b9 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/template/delete/RestDeleteIndexTemplateAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java @@ -16,10 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.indices.template.delete; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateRequest; -import org.elasticsearch.action.admin.indices.template.delete.DeleteIndexTemplateResponse; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; @@ -29,9 +28,6 @@ import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.support.AcknowledgedRestListener; -/** - * - */ public class RestDeleteIndexTemplateAction extends BaseRestHandler { @Inject @@ -44,6 +40,6 @@ public class RestDeleteIndexTemplateAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) { DeleteIndexTemplateRequest deleteIndexTemplateRequest = new DeleteIndexTemplateRequest(request.param("name")); deleteIndexTemplateRequest.masterNodeTimeout(request.paramAsTime("master_timeout", deleteIndexTemplateRequest.masterNodeTimeout())); - client.admin().indices().deleteTemplate(deleteIndexTemplateRequest, new AcknowledgedRestListener(channel)); + client.admin().indices().deleteTemplate(deleteIndexTemplateRequest, new AcknowledgedRestListener<>(channel)); } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java index 5156a95c0cc..e9beffb90ff 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestFlushAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.flush; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.flush.FlushRequest; import org.elasticsearch.action.admin.indices.flush.FlushResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/forcemerge/RestForceMergeAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/forcemerge/RestForceMergeAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java index ecdbdeae14c..7a4febb5cee 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/forcemerge/RestForceMergeAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.forcemerge; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeRequest; import org.elasticsearch.action.admin.indices.forcemerge.ForceMergeResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetAliasesAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetAliasesAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java index 8ecbc64b27f..772cb311cc6 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/get/RestGetAliasesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.alias.get; +package org.elasticsearch.rest.action.admin.indices; import com.carrotsearch.hppc.cursors.ObjectObjectCursor; import org.elasticsearch.action.admin.indices.alias.get.GetAliasesRequest; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetFieldMappingAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java similarity index 96% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetFieldMappingAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java index d2f77e95f52..496588ce8ed 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetFieldMappingAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.mapping.get; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsRequest; import org.elasticsearch.action.admin.indices.mapping.get.GetFieldMappingsResponse; @@ -37,16 +37,12 @@ import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; import org.elasticsearch.rest.action.support.RestBuilderListener; -import java.io.IOException; import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; import static org.elasticsearch.rest.RestStatus.OK; -/** - * - */ public class RestGetFieldMappingAction extends BaseRestHandler { @Inject @@ -94,7 +90,7 @@ public class RestGetFieldMappingAction extends BaseRestHandler { * Helper method to find out if the only included fieldmapping metadata is typed NULL, which means * that type and index exist, but the field did not */ - private boolean isFieldMappingMissingField(Map>> mappingsByIndex) throws IOException { + private boolean isFieldMappingMissingField(Map>> mappingsByIndex) { if (mappingsByIndex.size() != 1) { return false; } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java similarity index 64% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java index de4a0f00442..39fd3d9e991 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/template/get/RestGetIndexTemplateAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java @@ -16,36 +16,25 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.indices.template.get; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.cluster.metadata.IndexTemplateMetaData; import org.elasticsearch.common.Strings; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.common.xcontent.ToXContent; -import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; -import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.RestResponse; import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.rest.action.support.RestBuilderListener; - -import java.util.HashMap; -import java.util.Map; +import org.elasticsearch.rest.action.support.RestToXContentListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; import static org.elasticsearch.rest.RestStatus.OK; -/** - * - */ public class RestGetIndexTemplateAction extends BaseRestHandler { @Inject @@ -66,24 +55,12 @@ public class RestGetIndexTemplateAction extends BaseRestHandler { final boolean implicitAll = getIndexTemplatesRequest.names().length == 0; - client.admin().indices().getTemplates(getIndexTemplatesRequest, new RestBuilderListener(channel) { + client.admin().indices().getTemplates(getIndexTemplatesRequest, new RestToXContentListener(channel) { @Override - public RestResponse buildResponse(GetIndexTemplatesResponse getIndexTemplatesResponse, XContentBuilder builder) throws Exception { - boolean templateExists = getIndexTemplatesResponse.getIndexTemplates().size() > 0; + protected RestStatus getStatus(GetIndexTemplatesResponse response) { + boolean templateExists = false == response.getIndexTemplates().isEmpty(); - Map paramsMap = new HashMap<>(); - paramsMap.put("reduce_mappings", "true"); - ToXContent.Params params = new ToXContent.DelegatingMapParams(paramsMap, request); - - builder.startObject(); - for (IndexTemplateMetaData indexTemplateMetaData : getIndexTemplatesResponse.getIndexTemplates()) { - IndexTemplateMetaData.Builder.toXContent(indexTemplateMetaData, builder, params); - } - builder.endObject(); - - RestStatus restStatus = (templateExists || implicitAll) ? OK : NOT_FOUND; - - return new BytesRestResponse(restStatus, builder); + return (templateExists || implicitAll) ? OK : NOT_FOUND; } }); } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/get/RestGetIndicesAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java similarity index 95% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/get/RestGetIndicesAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java index 578cd2e4a62..37d17b0b4c8 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/get/RestGetIndicesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.indices.get; +package org.elasticsearch.rest.action.admin.indices; import com.carrotsearch.hppc.cursors.ObjectObjectCursor; import org.elasticsearch.action.admin.indices.get.GetIndexRequest; @@ -48,16 +48,14 @@ import java.util.List; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.OK; -/** - * - */ public class RestGetIndicesAction extends BaseRestHandler { private final IndexScopedSettings indexScopedSettings; private final SettingsFilter settingsFilter; @Inject - public RestGetIndicesAction(Settings settings, RestController controller, IndexScopedSettings indexScopedSettings, SettingsFilter settingsFilter) { + public RestGetIndicesAction(Settings settings, RestController controller, IndexScopedSettings indexScopedSettings, + SettingsFilter settingsFilter) { super(settings); this.indexScopedSettings = indexScopedSettings; controller.registerHandler(GET, "/{index}", this); @@ -87,8 +85,7 @@ public class RestGetIndicesAction extends BaseRestHandler { @Override public RestResponse buildResponse(GetIndexResponse response, XContentBuilder builder) throws Exception { - - Feature[] features = getIndexRequest.featuresAsEnums(); + Feature[] features = getIndexRequest.features(); String[] indices = response.indices(); builder.startObject(); @@ -127,7 +124,8 @@ public class RestGetIndicesAction extends BaseRestHandler { builder.endObject(); } - private void writeMappings(ImmutableOpenMap mappings, XContentBuilder builder, Params params) throws IOException { + private void writeMappings(ImmutableOpenMap mappings, XContentBuilder builder, Params params) + throws IOException { builder.startObject(Fields.MAPPINGS); if (mappings != null) { for (ObjectObjectCursor typeEntry : mappings) { @@ -145,7 +143,8 @@ public class RestGetIndicesAction extends BaseRestHandler { builder.endObject(); if (renderDefaults) { builder.startObject("defaults"); - settingsFilter.filter(indexScopedSettings.diff(settings, RestGetIndicesAction.this.settings)).toXContent(builder, request); + settingsFilter.filter(indexScopedSettings.diff(settings, RestGetIndicesAction.this.settings)).toXContent(builder, + request); builder.endObject(); } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java index c4f9dbf2333..8fc56235093 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/get/RestGetMappingAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java @@ -17,9 +17,10 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.mapping.get; +package org.elasticsearch.rest.action.admin.indices; import com.carrotsearch.hppc.cursors.ObjectObjectCursor; + import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequest; import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsResponse; import org.elasticsearch.action.support.IndicesOptions; @@ -30,7 +31,6 @@ import org.elasticsearch.common.collect.ImmutableOpenMap; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.index.Index; import org.elasticsearch.index.IndexNotFoundException; import org.elasticsearch.indices.TypeMissingException; import org.elasticsearch.rest.BaseRestHandler; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java similarity index 96% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java index 46a101161b6..f361942a20f 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestGetSettingsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.settings; +package org.elasticsearch.rest.action.admin.indices; import com.carrotsearch.hppc.cursors.ObjectObjectCursor; import org.elasticsearch.action.admin.indices.settings.get.GetSettingsRequest; @@ -47,7 +47,8 @@ public class RestGetSettingsAction extends BaseRestHandler { private final SettingsFilter settingsFilter; @Inject - public RestGetSettingsAction(Settings settings, RestController controller, IndexScopedSettings indexScopedSettings, final SettingsFilter settingsFilter) { + public RestGetSettingsAction(Settings settings, RestController controller, IndexScopedSettings indexScopedSettings, + final SettingsFilter settingsFilter) { super(settings); this.indexScopedSettings = indexScopedSettings; controller.registerHandler(GET, "/{index}/_settings/{name}", this); diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/template/head/RestHeadIndexTemplateAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestHeadIndexTemplateAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/template/head/RestHeadIndexTemplateAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestHeadIndexTemplateAction.java index b790782a01a..6de2503d130 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/template/head/RestHeadIndexTemplateAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestHeadIndexTemplateAction.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.indices.template.head; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesRequest; import org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/delete/RestIndexDeleteAliasesAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/delete/RestIndexDeleteAliasesAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java index eedac4d8eea..88e52df1964 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/delete/RestIndexDeleteAliasesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.indices.alias.delete; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/put/RestIndexPutAliasAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java similarity index 94% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/put/RestIndexPutAliasAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java index e9f5e294db4..d34de194ad5 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/put/RestIndexPutAliasAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.indices.alias.put; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions; @@ -39,8 +39,6 @@ import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; -/** - */ public class RestIndexPutAliasAction extends BaseRestHandler { @Inject @@ -87,9 +85,11 @@ public class RestIndexPutAliasAction extends BaseRestHandler { alias = parser.text(); } else if ("routing".equals(currentFieldName)) { routing = parser.textOrNull(); - } else if ("indexRouting".equals(currentFieldName) || "index-routing".equals(currentFieldName) || "index_routing".equals(currentFieldName)) { + } else if ("indexRouting".equals(currentFieldName) + || "index-routing".equals(currentFieldName) || "index_routing".equals(currentFieldName)) { indexRouting = parser.textOrNull(); - } else if ("searchRouting".equals(currentFieldName) || "search-routing".equals(currentFieldName) || "search_routing".equals(currentFieldName)) { + } else if ("searchRouting".equals(currentFieldName) + || "search-routing".equals(currentFieldName) || "search_routing".equals(currentFieldName)) { searchRouting = parser.textOrNull(); } } else if (token == XContentParser.Token.START_OBJECT) { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java similarity index 95% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java index dff4c492f17..fa727df4fc8 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/alias/RestIndicesAliasesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.alias; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest; import org.elasticsearch.action.admin.indices.alias.IndicesAliasesRequest.AliasActions; @@ -40,9 +40,6 @@ import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.POST; -/** - * - */ public class RestIndicesAliasesAction extends BaseRestHandler { @Inject @@ -101,10 +98,12 @@ public class RestIndicesAliasesAction extends BaseRestHandler { } else if ("routing".equals(currentFieldName)) { routing = parser.textOrNull(); routingSet = true; - } else if ("indexRouting".equals(currentFieldName) || "index-routing".equals(currentFieldName) || "index_routing".equals(currentFieldName)) { + } else if ("indexRouting".equals(currentFieldName) + || "index-routing".equals(currentFieldName) || "index_routing".equals(currentFieldName)) { indexRouting = parser.textOrNull(); indexRoutingSet = true; - } else if ("searchRouting".equals(currentFieldName) || "search-routing".equals(currentFieldName) || "search_routing".equals(currentFieldName)) { + } else if ("searchRouting".equals(currentFieldName) + || "search-routing".equals(currentFieldName) || "search_routing".equals(currentFieldName)) { searchRouting = parser.textOrNull(); searchRoutingSet = true; } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesExistsAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesExistsAction.java index f45f607356e..8d41ba647f3 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/indices/RestIndicesExistsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesExistsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.exists.indices; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java similarity index 95% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java index a1d5560e674..be8a22454e1 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/segments/RestIndicesSegmentsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.segments; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.segments.IndicesSegmentResponse; import org.elasticsearch.action.admin.indices.segments.IndicesSegmentsRequest; @@ -39,8 +39,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; -/** - */ public class RestIndicesSegmentsAction extends BaseRestHandler { @Inject @@ -52,7 +50,8 @@ public class RestIndicesSegmentsAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) { - IndicesSegmentsRequest indicesSegmentsRequest = new IndicesSegmentsRequest(Strings.splitStringByCommaToArray(request.param("index"))); + IndicesSegmentsRequest indicesSegmentsRequest = new IndicesSegmentsRequest( + Strings.splitStringByCommaToArray(request.param("index"))); indicesSegmentsRequest.verbose(request.paramAsBoolean("verbose", false)); indicesSegmentsRequest.indicesOptions(IndicesOptions.fromRequest(request, indicesSegmentsRequest.indicesOptions())); client.admin().indices().segments(indicesSegmentsRequest, new RestBuilderListener(channel) { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/shards/RestIndicesShardStoresAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java similarity index 95% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/shards/RestIndicesShardStoresAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java index 8a0d61c933c..615c758bd5d 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/shards/RestIndicesShardStoresAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.shards; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresAction; import org.elasticsearch.action.admin.indices.shards.IndicesShardStoresRequest; @@ -53,7 +53,8 @@ public class RestIndicesShardStoresAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) { - IndicesShardStoresRequest indicesShardStoresRequest = new IndicesShardStoresRequest(Strings.splitStringByCommaToArray(request.param("index"))); + IndicesShardStoresRequest indicesShardStoresRequest = new IndicesShardStoresRequest( + Strings.splitStringByCommaToArray(request.param("index"))); if (request.hasParam("status")) { indicesShardStoresRequest.shardStatuses(Strings.splitStringByCommaToArray(request.param("status"))); } diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java similarity index 93% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java index 93a1dea9b5e..b9f146a1015 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/stats/RestIndicesStatsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.stats; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.stats.IndicesStatsRequest; import org.elasticsearch.action.admin.indices.stats.IndicesStatsResponse; @@ -41,8 +41,6 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.OK; import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; -/** - */ public class RestIndicesStatsAction extends BaseRestHandler { @Inject @@ -95,11 +93,13 @@ public class RestIndicesStatsAction extends BaseRestHandler { } if (indicesStatsRequest.completion() && (request.hasParam("fields") || request.hasParam("completion_fields"))) { - indicesStatsRequest.completionFields(request.paramAsStringArray("completion_fields", request.paramAsStringArray("fields", Strings.EMPTY_ARRAY))); + indicesStatsRequest.completionFields( + request.paramAsStringArray("completion_fields", request.paramAsStringArray("fields", Strings.EMPTY_ARRAY))); } if (indicesStatsRequest.fieldData() && (request.hasParam("fields") || request.hasParam("fielddata_fields"))) { - indicesStatsRequest.fieldDataFields(request.paramAsStringArray("fielddata_fields", request.paramAsStringArray("fields", Strings.EMPTY_ARRAY))); + indicesStatsRequest.fieldDataFields( + request.paramAsStringArray("fielddata_fields", request.paramAsStringArray("fields", Strings.EMPTY_ARRAY))); } if (indicesStatsRequest.segments() && request.hasParam("include_segment_file_sizes")) { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java index 9f27d8e3666..883a59b17a1 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/open/RestOpenIndexAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.open; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.open.OpenIndexRequest; import org.elasticsearch.action.admin.indices.open.OpenIndexResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java index 77f91cebdf7..bb7c99ec7b1 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/template/put/RestPutIndexTemplateAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.indices.template.put; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java index 7a0d07cd2ed..ad0c68a4610 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/mapping/put/RestPutMappingAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.mapping.put; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingRequest; import org.elasticsearch.action.admin.indices.mapping.put.PutMappingResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/recovery/RestRecoveryAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/recovery/RestRecoveryAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java index 6178d2559b5..e2fa172eaa6 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/recovery/RestRecoveryAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.recovery; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.recovery.RecoveryRequest; import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java index 6e2fcec3f51..763274c19fb 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/refresh/RestRefreshAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.refresh; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.refresh.RefreshRequest; import org.elasticsearch.action.admin.indices.refresh.RefreshResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestSyncedFlushAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestSyncedFlushAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java index 70d311c6e04..b06d05cbd37 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/flush/RestSyncedFlushAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.flush; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.flush.SyncedFlushRequest; import org.elasticsearch.action.admin.indices.flush.SyncedFlushResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestTypesExistsAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestTypesExistsAction.java index 2ac0d1354f1..b58daf63cb1 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/exists/types/RestTypesExistsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestTypesExistsAction.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.indices.exists.types; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; import org.elasticsearch.action.admin.indices.exists.types.TypesExistsResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java index 877a5a45fbe..1b8e242550a 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/settings/RestUpdateSettingsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.settings; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRequest; import org.elasticsearch.action.support.IndicesOptions; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/upgrade/RestUpgradeAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/upgrade/RestUpgradeAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeAction.java index ee2aa156adc..c6eb78a5275 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/upgrade/RestUpgradeAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeAction.java @@ -17,14 +17,13 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.upgrade; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.Version; import org.elasticsearch.action.admin.indices.upgrade.get.UpgradeStatusResponse; import org.elasticsearch.action.admin.indices.upgrade.post.UpgradeRequest; import org.elasticsearch.action.admin.indices.upgrade.post.UpgradeResponse; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; import org.elasticsearch.common.collect.Tuple; import org.elasticsearch.common.inject.Inject; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java similarity index 96% rename from core/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java rename to core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java index 2000078e011..bea47823ee5 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/validate/query/RestValidateQueryAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.admin.indices.validate.query; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.validate.query.QueryExplanation; import org.elasticsearch.action.admin.indices.validate.query.ValidateQueryRequest; @@ -73,7 +73,8 @@ public class RestValidateQueryAction extends BaseRestHandler { validateQueryRequest.explain(request.paramAsBoolean("explain", false)); if (RestActions.hasBodyContent(request)) { try { - validateQueryRequest.query(RestActions.getQueryContent(RestActions.getRestContent(request), indicesQueriesRegistry, parseFieldMatcher)); + validateQueryRequest + .query(RestActions.getQueryContent(RestActions.getRestContent(request), indicesQueriesRegistry, parseFieldMatcher)); } catch(ParsingException e) { channel.sendResponse(buildErrorResponse(channel.newBuilder(), e.getDetailedMessage(), validateQueryRequest.explain())); return; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/package-info.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/package-info.java new file mode 100644 index 00000000000..3e103b4f6cb --- /dev/null +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/package-info.java @@ -0,0 +1,24 @@ +/* + * Licensed to Elasticsearch under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/** + * {@link org.elasticsearch.rest.RestHandler}s for administrative actions that can be taken on indexes like creation, deletion, setting up + * aliases, and changing mapping. + */ +package org.elasticsearch.rest.action.admin.indices; \ No newline at end of file diff --git a/core/src/test/java/org/elasticsearch/ExceptionSerializationTests.java b/core/src/test/java/org/elasticsearch/ExceptionSerializationTests.java index b9f3d443089..a3b0629e8ab 100644 --- a/core/src/test/java/org/elasticsearch/ExceptionSerializationTests.java +++ b/core/src/test/java/org/elasticsearch/ExceptionSerializationTests.java @@ -64,7 +64,7 @@ import org.elasticsearch.indices.InvalidIndexTemplateException; import org.elasticsearch.indices.recovery.RecoverFilesRecoveryException; import org.elasticsearch.repositories.RepositoryException; import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.rest.action.admin.indices.alias.delete.AliasesNotFoundException; +import org.elasticsearch.rest.action.admin.indices.AliasesNotFoundException; import org.elasticsearch.search.SearchContextMissingException; import org.elasticsearch.search.SearchException; import org.elasticsearch.search.SearchParseException; @@ -760,7 +760,7 @@ public class ExceptionSerializationTests extends ESTestCase { ids.put(110, org.elasticsearch.index.engine.FlushNotAllowedEngineException.class); ids.put(111, org.elasticsearch.common.settings.NoClassSettingsException.class); ids.put(112, org.elasticsearch.transport.BindTransportException.class); - ids.put(113, org.elasticsearch.rest.action.admin.indices.alias.delete.AliasesNotFoundException.class); + ids.put(113, org.elasticsearch.rest.action.admin.indices.AliasesNotFoundException.class); ids.put(114, org.elasticsearch.index.shard.IndexShardRecoveringException.class); ids.put(115, org.elasticsearch.index.translog.TranslogException.class); ids.put(116, org.elasticsearch.cluster.metadata.ProcessClusterEventTimeoutException.class); diff --git a/core/src/test/java/org/elasticsearch/aliases/IndexAliasesIT.java b/core/src/test/java/org/elasticsearch/aliases/IndexAliasesIT.java index 28d068d7608..a92125476ea 100644 --- a/core/src/test/java/org/elasticsearch/aliases/IndexAliasesIT.java +++ b/core/src/test/java/org/elasticsearch/aliases/IndexAliasesIT.java @@ -40,7 +40,7 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.index.query.QueryBuilder; import org.elasticsearch.index.query.QueryBuilders; -import org.elasticsearch.rest.action.admin.indices.alias.delete.AliasesNotFoundException; +import org.elasticsearch.rest.action.admin.indices.AliasesNotFoundException; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.SearchHits; import org.elasticsearch.search.aggregations.AggregationBuilders; diff --git a/core/src/test/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeActionTests.java b/core/src/test/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeActionTests.java similarity index 98% rename from core/src/test/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeActionTests.java rename to core/src/test/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeActionTests.java index 4b2a6703252..de188ba9e91 100644 --- a/core/src/test/java/org/elasticsearch/rest/action/admin/indices/analyze/RestAnalyzeActionTests.java +++ b/core/src/test/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeActionTests.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.admin.indices.analyze; +package org.elasticsearch.rest.action.admin.indices; import org.elasticsearch.action.admin.indices.analyze.AnalyzeRequest; import org.elasticsearch.common.ParseFieldMatcher; @@ -25,7 +25,6 @@ import org.elasticsearch.common.bytes.BytesReference; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.test.ESTestCase; -import org.hamcrest.core.IsNull; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf;