diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index a2deaa995a8..d996be40f87 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -270,7 +270,7 @@ class BuildPlugin implements Plugin { // add exclusions to the pom directly, for each of the transitive deps of this project's deps project.modifyPom { MavenPom pom -> - pom.withXml(removeTransitiveDependencies(project)) + pom.withXml(fixupDependencies(project)) } } @@ -299,9 +299,16 @@ class BuildPlugin implements Plugin { } } - /** Returns a closure which can be used with a MavenPom for removing transitive dependencies. */ - private static Closure removeTransitiveDependencies(Project project) { - // TODO: remove this when enforcing gradle 2.13+, it now properly handles exclusions + /** + * Returns a closure which can be used with a MavenPom for fixing problems with gradle generated poms. + * + * + */ + private static Closure fixupDependencies(Project project) { + // TODO: remove this when enforcing gradle 2.14+, it now properly handles exclusions return { XmlProvider xml -> // first find if we have dependencies at all, and grab the node NodeList depsNodes = xml.asNode().get('dependencies') @@ -315,6 +322,15 @@ class BuildPlugin implements Plugin { String artifactId = depNode.get('artifactId').get(0).text() String version = depNode.get('version').get(0).text() + // fix deps incorrectly marked as runtime back to compile time deps + // see https://discuss.gradle.org/t/maven-publish-plugin-generated-pom-making-dependency-scope-runtime/7494/4 + boolean isCompileDep = project.configurations.compile.allDependencies.find { dep -> + dep.name == depNode.artifactId.text() + } + if (depNode.scope.text() == 'runtime' && isCompileDep) { + depNode.scope*.value = 'compile' + } + // collect the transitive deps now that we know what this dependency is String depConfig = transitiveDepConfigName(groupId, artifactId, version) Configuration configuration = project.configurations.findByName(depConfig) @@ -327,17 +343,10 @@ class BuildPlugin implements Plugin { continue } - // we now know we have something to exclude, so add the exclusion elements - Node exclusions = depNode.appendNode('exclusions') - for (ResolvedArtifact transitiveArtifact : artifacts) { - ModuleVersionIdentifier transitiveDep = transitiveArtifact.moduleVersion.id - if (transitiveDep.group == groupId && transitiveDep.name == artifactId) { - continue; // don't exclude the dependency itself! - } - Node exclusion = exclusions.appendNode('exclusion') - exclusion.appendNode('groupId', transitiveDep.group) - exclusion.appendNode('artifactId', transitiveDep.name) - } + // we now know we have something to exclude, so add a wildcard exclusion element + Node exclusion = depNode.appendNode('exclusions').appendNode('exclusion') + exclusion.appendNode('groupId', '*') + exclusion.appendNode('artifactId', '*') } } } @@ -349,7 +358,7 @@ class BuildPlugin implements Plugin { publications { all { MavenPublication publication -> // we only deal with maven // add exclusions to the pom directly, for each of the transitive deps of this project's deps - publication.pom.withXml(removeTransitiveDependencies(project)) + publication.pom.withXml(fixupDependencies(project)) } } } diff --git a/buildSrc/src/main/resources/checkstyle_suppressions.xml b/buildSrc/src/main/resources/checkstyle_suppressions.xml index 14c98d42e36..9e1574987ee 100644 --- a/buildSrc/src/main/resources/checkstyle_suppressions.xml +++ b/buildSrc/src/main/resources/checkstyle_suppressions.xml @@ -486,20 +486,12 @@ - - - - - - - - @@ -1116,7 +1108,6 @@ - diff --git a/core/src/main/java/org/apache/lucene/search/vectorhighlight/CustomFieldQuery.java b/core/src/main/java/org/apache/lucene/search/vectorhighlight/CustomFieldQuery.java index e455340e3a0..88b045d2a5e 100644 --- a/core/src/main/java/org/apache/lucene/search/vectorhighlight/CustomFieldQuery.java +++ b/core/src/main/java/org/apache/lucene/search/vectorhighlight/CustomFieldQuery.java @@ -22,6 +22,8 @@ package org.apache.lucene.search.vectorhighlight; import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.Term; import org.apache.lucene.queries.BlendedTermQuery; +import org.apache.lucene.queries.BoostingQuery; +import org.apache.lucene.search.BoostQuery; import org.apache.lucene.search.ConstantScoreQuery; import org.apache.lucene.search.MultiPhraseQuery; import org.apache.lucene.search.PhraseQuery; @@ -56,7 +58,12 @@ public class CustomFieldQuery extends FieldQuery { @Override void flatten(Query sourceQuery, IndexReader reader, Collection flatQueries, float boost) throws IOException { - if (sourceQuery instanceof SpanTermQuery) { + if (sourceQuery instanceof BoostQuery) { + BoostQuery bq = (BoostQuery) sourceQuery; + sourceQuery = bq.getQuery(); + boost *= bq.getBoost(); + flatten(sourceQuery, reader, flatQueries, boost); + } else if (sourceQuery instanceof SpanTermQuery) { super.flatten(new TermQuery(((SpanTermQuery) sourceQuery).getTerm()), reader, flatQueries, boost); } else if (sourceQuery instanceof ConstantScoreQuery) { flatten(((ConstantScoreQuery) sourceQuery).getQuery(), reader, flatQueries, boost); @@ -75,6 +82,12 @@ public class CustomFieldQuery extends FieldQuery { } else if (sourceQuery instanceof ToParentBlockJoinQuery) { ToParentBlockJoinQuery blockJoinQuery = (ToParentBlockJoinQuery) sourceQuery; flatten(blockJoinQuery.getChildQuery(), reader, flatQueries, boost); + } else if (sourceQuery instanceof BoostingQuery) { + BoostingQuery boostingQuery = (BoostingQuery) sourceQuery; + //flatten positive query with query boost + flatten(boostingQuery.getMatch(), reader, flatQueries, boost); + //flatten negative query with negative boost + flatten(boostingQuery.getContext(), reader, flatQueries, boostingQuery.getBoost()); } else { super.flatten(sourceQuery, reader, flatQueries, boost); } diff --git a/core/src/main/java/org/elasticsearch/action/ActionModule.java b/core/src/main/java/org/elasticsearch/action/ActionModule.java index 9bff5fda187..ca5349661c5 100644 --- a/core/src/main/java/org/elasticsearch/action/ActionModule.java +++ b/core/src/main/java/org/elasticsearch/action/ActionModule.java @@ -209,6 +209,8 @@ import org.elasticsearch.plugins.ActionPlugin; import org.elasticsearch.plugins.ActionPlugin.ActionHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestHandler; +import org.elasticsearch.rest.action.RestFieldStatsAction; +import org.elasticsearch.rest.action.RestMainAction; import org.elasticsearch.rest.action.admin.cluster.RestCancelTasksAction; import org.elasticsearch.rest.action.admin.cluster.RestClusterAllocationExplainAction; import org.elasticsearch.rest.action.admin.cluster.RestClusterGetSettingsAction; @@ -271,7 +273,6 @@ 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; import org.elasticsearch.rest.action.cat.RestAllocationAction; @@ -289,27 +290,26 @@ import org.elasticsearch.rest.action.cat.RestShardsAction; import org.elasticsearch.rest.action.cat.RestSnapshotAction; import org.elasticsearch.rest.action.cat.RestTasksAction; import org.elasticsearch.rest.action.cat.RestThreadPoolAction; -import org.elasticsearch.rest.action.delete.RestDeleteAction; -import org.elasticsearch.rest.action.explain.RestExplainAction; -import org.elasticsearch.rest.action.fieldstats.RestFieldStatsAction; -import org.elasticsearch.rest.action.get.RestGetAction; -import org.elasticsearch.rest.action.get.RestGetSourceAction; -import org.elasticsearch.rest.action.get.RestHeadAction; -import org.elasticsearch.rest.action.get.RestMultiGetAction; -import org.elasticsearch.rest.action.index.RestIndexAction; +import org.elasticsearch.rest.action.document.RestBulkAction; +import org.elasticsearch.rest.action.document.RestDeleteAction; +import org.elasticsearch.rest.action.document.RestGetAction; +import org.elasticsearch.rest.action.document.RestGetSourceAction; +import org.elasticsearch.rest.action.document.RestHeadAction; +import org.elasticsearch.rest.action.document.RestIndexAction; +import org.elasticsearch.rest.action.document.RestMultiGetAction; +import org.elasticsearch.rest.action.document.RestMultiTermVectorsAction; +import org.elasticsearch.rest.action.document.RestTermVectorsAction; +import org.elasticsearch.rest.action.document.RestUpdateAction; import org.elasticsearch.rest.action.ingest.RestDeletePipelineAction; import org.elasticsearch.rest.action.ingest.RestGetPipelineAction; import org.elasticsearch.rest.action.ingest.RestPutPipelineAction; import org.elasticsearch.rest.action.ingest.RestSimulatePipelineAction; -import org.elasticsearch.rest.action.main.RestMainAction; import org.elasticsearch.rest.action.search.RestClearScrollAction; +import org.elasticsearch.rest.action.search.RestExplainAction; import org.elasticsearch.rest.action.search.RestMultiSearchAction; import org.elasticsearch.rest.action.search.RestSearchAction; import org.elasticsearch.rest.action.search.RestSearchScrollAction; -import org.elasticsearch.rest.action.suggest.RestSuggestAction; -import org.elasticsearch.rest.action.termvectors.RestMultiTermVectorsAction; -import org.elasticsearch.rest.action.termvectors.RestTermVectorsAction; -import org.elasticsearch.rest.action.update.RestUpdateAction; +import org.elasticsearch.rest.action.search.RestSuggestAction; import static java.util.Collections.unmodifiableList; import static java.util.Collections.unmodifiableMap; @@ -546,7 +546,7 @@ public class ActionModule extends AbstractModule { registerRestHandler(handlers, RestHeadAction.Source.class); registerRestHandler(handlers, RestMultiGetAction.class); registerRestHandler(handlers, RestDeleteAction.class); - registerRestHandler(handlers, org.elasticsearch.rest.action.count.RestCountAction.class); + registerRestHandler(handlers, org.elasticsearch.rest.action.document.RestCountAction.class); registerRestHandler(handlers, RestSuggestAction.class); registerRestHandler(handlers, RestTermVectorsAction.class); registerRestHandler(handlers, RestMultiTermVectorsAction.class); diff --git a/core/src/main/java/org/elasticsearch/action/ActionRequest.java b/core/src/main/java/org/elasticsearch/action/ActionRequest.java index bc052895a6f..970afa413cc 100644 --- a/core/src/main/java/org/elasticsearch/action/ActionRequest.java +++ b/core/src/main/java/org/elasticsearch/action/ActionRequest.java @@ -40,9 +40,9 @@ public abstract class ActionRequest> exte public abstract ActionRequestValidationException validate(); /** - * Should this task persist its result after it has finished? + * Should this task store its result after it has finished? */ - public boolean getShouldPersistResult() { + public boolean getShouldStoreResult() { return false; } diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/tasks/get/GetTaskResponse.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/tasks/get/GetTaskResponse.java index afb03a7c9dc..ffd4b358314 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/tasks/get/GetTaskResponse.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/tasks/get/GetTaskResponse.java @@ -25,7 +25,7 @@ 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 org.elasticsearch.tasks.PersistedTaskInfo; +import org.elasticsearch.tasks.TaskResult; import java.io.IOException; @@ -35,19 +35,19 @@ import static java.util.Objects.requireNonNull; * Returns the list of tasks currently running on the nodes */ public class GetTaskResponse extends ActionResponse implements ToXContent { - private PersistedTaskInfo task; + private TaskResult task; public GetTaskResponse() { } - public GetTaskResponse(PersistedTaskInfo task) { + public GetTaskResponse(TaskResult task) { this.task = requireNonNull(task, "task is required"); } @Override public void readFrom(StreamInput in) throws IOException { super.readFrom(in); - task = in.readOptionalWriteable(PersistedTaskInfo::new); + task = in.readOptionalWriteable(TaskResult::new); } @Override @@ -59,7 +59,7 @@ public class GetTaskResponse extends ActionResponse implements ToXContent { /** * Get the actual result of the fetch. */ - public PersistedTaskInfo getTask() { + public TaskResult getTask() { return task; } diff --git a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/tasks/get/TransportGetTaskAction.java b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/tasks/get/TransportGetTaskAction.java index 430b07866c9..dc77a1a6e84 100644 --- a/core/src/main/java/org/elasticsearch/action/admin/cluster/node/tasks/get/TransportGetTaskAction.java +++ b/core/src/main/java/org/elasticsearch/action/admin/cluster/node/tasks/get/TransportGetTaskAction.java @@ -38,11 +38,11 @@ import org.elasticsearch.common.util.concurrent.AbstractRunnable; import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.index.IndexNotFoundException; -import org.elasticsearch.tasks.PersistedTaskInfo; +import org.elasticsearch.tasks.TaskResult; import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.TaskId; import org.elasticsearch.tasks.TaskInfo; -import org.elasticsearch.tasks.TaskPersistenceService; +import org.elasticsearch.tasks.TaskResultsService; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportException; import org.elasticsearch.transport.TransportRequestOptions; @@ -160,7 +160,7 @@ public class TransportGetTaskAction extends HandledTransportAction listener) { - GetRequest get = new GetRequest(TaskPersistenceService.TASK_INDEX, TaskPersistenceService.TASK_TYPE, + GetRequest get = new GetRequest(TaskResultsService.TASK_INDEX, TaskResultsService.TASK_TYPE, request.getTaskId().toString()); get.setParentTask(clusterService.localNode().getId(), thisTask.getId()); client.get(get, new ActionListener() { @@ -216,7 +216,8 @@ public class TransportGetTaskAction extends HandledTransportAction listener) throws IOException { if (false == response.isExists()) { - listener.onFailure(new ResourceNotFoundException("task [{}] isn't running or persisted", response.getId())); + listener.onFailure(new ResourceNotFoundException("task [{}] isn't running or stored its results", response.getId())); return; } if (response.isSourceEmpty()) { @@ -238,7 +239,7 @@ public class TransportGetTaskAction extends HandledTransportAction ParseFieldMatcher.STRICT); + TaskResult result = TaskResult.PARSER.apply(parser, () -> ParseFieldMatcher.STRICT); listener.onResponse(new GetTaskResponse(result)); } } diff --git a/core/src/main/java/org/elasticsearch/action/search/SearchRequest.java b/core/src/main/java/org/elasticsearch/action/search/SearchRequest.java index 1973e4c756d..a1b1a02a97e 100644 --- a/core/src/main/java/org/elasticsearch/action/search/SearchRequest.java +++ b/core/src/main/java/org/elasticsearch/action/search/SearchRequest.java @@ -33,8 +33,8 @@ import org.elasticsearch.search.Scroll; import org.elasticsearch.search.builder.SearchSourceBuilder; import java.io.IOException; - -import static org.elasticsearch.search.Scroll.readScroll; +import java.util.Arrays; +import java.util.Objects; /** * A request to execute search against one or more indices (or all). Best created using @@ -47,11 +47,11 @@ import static org.elasticsearch.search.Scroll.readScroll; * @see org.elasticsearch.client.Client#search(SearchRequest) * @see SearchResponse */ -public class SearchRequest extends ActionRequest implements IndicesRequest.Replaceable { +public final class SearchRequest extends ActionRequest implements IndicesRequest.Replaceable { private SearchType searchType = SearchType.DEFAULT; - private String[] indices; + private String[] indices = Strings.EMPTY_ARRAY; @Nullable private String routing; @@ -94,12 +94,7 @@ public class SearchRequest extends ActionRequest implements Indic @Override public ActionRequestValidationException validate() { - ActionRequestValidationException validationException = null; - // no need to check, we resolve to match all query -// if (source == null && extraSource == null) { -// validationException = addValidationError("search source is missing", validationException); -// } - return validationException; + return null; } /** @@ -107,14 +102,9 @@ public class SearchRequest extends ActionRequest implements Indic */ @Override public SearchRequest indices(String... indices) { - if (indices == null) { - throw new IllegalArgumentException("indices must not be null"); - } else { - for (int i = 0; i < indices.length; i++) { - if (indices[i] == null) { - throw new IllegalArgumentException("indices[" + i + "] must not be null"); - } - } + Objects.requireNonNull(indices, "indices must not be null"); + for (String index : indices) { + Objects.requireNonNull(index, "index must not be null"); } this.indices = indices; return this; @@ -126,7 +116,7 @@ public class SearchRequest extends ActionRequest implements Indic } public SearchRequest indicesOptions(IndicesOptions indicesOptions) { - this.indicesOptions = indicesOptions; + this.indicesOptions = Objects.requireNonNull(indicesOptions, "indicesOptions must not be null"); return this; } @@ -143,6 +133,10 @@ public class SearchRequest extends ActionRequest implements Indic * all types. */ public SearchRequest types(String... types) { + Objects.requireNonNull(types, "types must not be null"); + for (String type : types) { + Objects.requireNonNull(type, "type must not be null"); + } this.types = types; return this; } @@ -188,7 +182,7 @@ public class SearchRequest extends ActionRequest implements Indic * The search type to execute, defaults to {@link SearchType#DEFAULT}. */ public SearchRequest searchType(SearchType searchType) { - this.searchType = searchType; + this.searchType = Objects.requireNonNull(searchType, "searchType must not be null"); return this; } @@ -205,10 +199,7 @@ public class SearchRequest extends ActionRequest implements Indic * The source of the search request. */ public SearchRequest source(SearchSourceBuilder sourceBuilder) { - if (sourceBuilder == null) { - throw new IllegalArgumentException("source must not be null"); - } - this.source = sourceBuilder; + this.source = Objects.requireNonNull(sourceBuilder, "source must not be null"); return this; } @@ -288,25 +279,16 @@ public class SearchRequest extends ActionRequest implements Indic public void readFrom(StreamInput in) throws IOException { super.readFrom(in); searchType = SearchType.fromId(in.readByte()); - indices = new String[in.readVInt()]; for (int i = 0; i < indices.length; i++) { indices[i] = in.readString(); } - routing = in.readOptionalString(); preference = in.readOptionalString(); - - if (in.readBoolean()) { - scroll = readScroll(in); - } - if (in.readBoolean()) { - source = new SearchSourceBuilder(in); - } - + scroll = in.readOptionalWriteable(Scroll::new); + source = in.readOptionalWriteable(SearchSourceBuilder::new); types = in.readStringArray(); indicesOptions = IndicesOptions.readIndicesOptions(in); - requestCache = in.readOptionalBoolean(); } @@ -314,29 +296,56 @@ public class SearchRequest extends ActionRequest implements Indic public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeByte(searchType.id()); - out.writeVInt(indices.length); for (String index : indices) { out.writeString(index); } - out.writeOptionalString(routing); out.writeOptionalString(preference); - - if (scroll == null) { - out.writeBoolean(false); - } else { - out.writeBoolean(true); - scroll.writeTo(out); - } - if (source == null) { - out.writeBoolean(false); - } else { - out.writeBoolean(true); - source.writeTo(out); - } + out.writeOptionalWriteable(scroll); + out.writeOptionalWriteable(source); out.writeStringArray(types); indicesOptions.writeIndicesOptions(out); out.writeOptionalBoolean(requestCache); } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchRequest that = (SearchRequest) o; + return searchType == that.searchType && + Arrays.equals(indices, that.indices) && + Objects.equals(routing, that.routing) && + Objects.equals(preference, that.preference) && + Objects.equals(source, that.source) && + Objects.equals(requestCache, that.requestCache) && + Objects.equals(scroll, that.scroll) && + Arrays.equals(types, that.types) && + Objects.equals(indicesOptions, that.indicesOptions); + } + + @Override + public int hashCode() { + return Objects.hash(searchType, Arrays.hashCode(indices), routing, preference, source, requestCache, + scroll, Arrays.hashCode(types), indicesOptions); + } + + @Override + public String toString() { + return "SearchRequest{" + + "searchType=" + searchType + + ", indices=" + Arrays.toString(indices) + + ", indicesOptions=" + indicesOptions + + ", types=" + Arrays.toString(types) + + ", routing='" + routing + '\'' + + ", preference='" + preference + '\'' + + ", requestCache=" + requestCache + + ", scroll=" + scroll + + ", source=" + source + '}'; + } } diff --git a/core/src/main/java/org/elasticsearch/action/search/SearchResponse.java b/core/src/main/java/org/elasticsearch/action/search/SearchResponse.java index 98d63b07b5e..3135d2c8f53 100644 --- a/core/src/main/java/org/elasticsearch/action/search/SearchResponse.java +++ b/core/src/main/java/org/elasticsearch/action/search/SearchResponse.java @@ -28,7 +28,7 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.StatusToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.rest.action.support.RestActions; +import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.search.SearchHits; import org.elasticsearch.search.aggregations.Aggregations; import org.elasticsearch.search.internal.InternalSearchResponse; diff --git a/core/src/main/java/org/elasticsearch/action/search/SearchScrollRequest.java b/core/src/main/java/org/elasticsearch/action/search/SearchScrollRequest.java index c1ff788dae5..9ab2a4cf560 100644 --- a/core/src/main/java/org/elasticsearch/action/search/SearchScrollRequest.java +++ b/core/src/main/java/org/elasticsearch/action/search/SearchScrollRequest.java @@ -27,9 +27,9 @@ import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.search.Scroll; import java.io.IOException; +import java.util.Objects; import static org.elasticsearch.action.ValidateActions.addValidationError; -import static org.elasticsearch.search.Scroll.readScroll; /** * @@ -100,20 +100,39 @@ public class SearchScrollRequest extends ActionRequest { public void readFrom(StreamInput in) throws IOException { super.readFrom(in); scrollId = in.readString(); - if (in.readBoolean()) { - scroll = readScroll(in); - } + scroll = in.readOptionalWriteable(Scroll::new); } @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeString(scrollId); - if (scroll == null) { - out.writeBoolean(false); - } else { - out.writeBoolean(true); - scroll.writeTo(out); + out.writeOptionalWriteable(scroll); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } + if (o == null || getClass() != o.getClass()) { + return false; + } + SearchScrollRequest that = (SearchScrollRequest) o; + return Objects.equals(scrollId, that.scrollId) && + Objects.equals(scroll, that.scroll); + } + + @Override + public int hashCode() { + return Objects.hash(scrollId, scroll); + } + + @Override + public String toString() { + return "SearchScrollRequest{" + + "scrollId='" + scrollId + '\'' + + ", scroll=" + scroll + + '}'; } } diff --git a/core/src/main/java/org/elasticsearch/action/support/TransportAction.java b/core/src/main/java/org/elasticsearch/action/support/TransportAction.java index 03408dab77f..582878a427d 100644 --- a/core/src/main/java/org/elasticsearch/action/support/TransportAction.java +++ b/core/src/main/java/org/elasticsearch/action/support/TransportAction.java @@ -137,8 +137,8 @@ public abstract class TransportAction, Re return; } - if (task != null && request.getShouldPersistResult()) { - listener = new PersistentActionListener<>(taskManager, task, listener); + if (task != null && request.getShouldStoreResult()) { + listener = new TaskResultStoringActionListener<>(taskManager, task, listener); } if (filters.length == 0) { @@ -256,14 +256,14 @@ public abstract class TransportAction, Re } /** - * Wrapper for an action listener that persists the result at the end of the execution + * Wrapper for an action listener that stores the result at the end of the execution */ - private static class PersistentActionListener implements ActionListener { + private static class TaskResultStoringActionListener implements ActionListener { private final ActionListener delegate; private final Task task; private final TaskManager taskManager; - private PersistentActionListener(TaskManager taskManager, Task task, ActionListener delegate) { + private TaskResultStoringActionListener(TaskManager taskManager, Task task, ActionListener delegate) { this.taskManager = taskManager; this.task = task; this.delegate = delegate; @@ -272,7 +272,7 @@ public abstract class TransportAction, Re @Override public void onResponse(Response response) { try { - taskManager.persistResult(task, response, delegate); + taskManager.storeResult(task, response, delegate); } catch (Exception e) { delegate.onFailure(e); } @@ -281,7 +281,7 @@ public abstract class TransportAction, Re @Override public void onFailure(Exception e) { try { - taskManager.persistResult(task, e, delegate); + taskManager.storeResult(task, e, delegate); } catch (Exception inner) { inner.addSuppressed(e); delegate.onFailure(inner); diff --git a/core/src/main/java/org/elasticsearch/cluster/ClusterModule.java b/core/src/main/java/org/elasticsearch/cluster/ClusterModule.java index fac138ce820..581844e28f4 100644 --- a/core/src/main/java/org/elasticsearch/cluster/ClusterModule.java +++ b/core/src/main/java/org/elasticsearch/cluster/ClusterModule.java @@ -61,7 +61,7 @@ import org.elasticsearch.common.settings.Setting.Property; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.ExtensionPoint; import org.elasticsearch.gateway.GatewayAllocator; -import org.elasticsearch.tasks.TaskPersistenceService; +import org.elasticsearch.tasks.TaskResultsService; import java.util.Arrays; import java.util.Collections; @@ -160,6 +160,6 @@ public class ClusterModule extends AbstractModule { bind(ShardStateAction.class).asEagerSingleton(); bind(NodeMappingRefreshAction.class).asEagerSingleton(); bind(MappingUpdatedAction.class).asEagerSingleton(); - bind(TaskPersistenceService.class).asEagerSingleton(); + bind(TaskResultsService.class).asEagerSingleton(); } } diff --git a/core/src/main/java/org/elasticsearch/index/analysis/AnalysisService.java b/core/src/main/java/org/elasticsearch/index/analysis/AnalysisService.java index 8d8d8f8c73a..cb84e6c6d0a 100644 --- a/core/src/main/java/org/elasticsearch/index/analysis/AnalysisService.java +++ b/core/src/main/java/org/elasticsearch/index/analysis/AnalysisService.java @@ -21,16 +21,14 @@ package org.elasticsearch.index.analysis; import org.apache.lucene.analysis.Analyzer; import org.elasticsearch.Version; -import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.index.AbstractIndexComponent; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.mapper.TextFieldMapper; import java.io.Closeable; -import java.util.Arrays; import java.util.HashMap; -import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -151,16 +149,22 @@ public class AnalysisService extends AbstractIndexComponent implements Closeable throw new IllegalStateException("already registered analyzer with name: " + name); } analyzers.put(name, analyzer); - String strAliases = this.indexSettings.getSettings().get("index.analysis.analyzer." + analyzerFactory.name() + ".alias"); - Set aliases = new HashSet<>(); - if (strAliases != null) { - aliases.addAll(Strings.commaDelimitedListToSet(strAliases)); - } - aliases.addAll(Arrays.asList(this.indexSettings.getSettings() - .getAsArray("index.analysis.analyzer." + analyzerFactory.name() + ".alias"))); - for (String alias : aliases) { - if (analyzerAliases.putIfAbsent(alias, analyzer) != null) { - throw new IllegalStateException("alias [" + alias + "] is already used by [" + analyzerAliases.get(alias).name() + "]"); + // TODO: remove alias support completely when we no longer support pre 5.0 indices + final String analyzerAliasKey = "index.analysis.analyzer." + analyzerFactory.name() + ".alias"; + if (indexSettings.getSettings().get(analyzerAliasKey) != null) { + if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_5_0_0_alpha6)) { + // do not allow alias creation if the index was created on or after v5.0 alpha6 + throw new IllegalArgumentException("setting [" + analyzerAliasKey + "] is not supported"); + } + + // the setting is now removed but we only support it for loading indices created before v5.0 + deprecationLogger.deprecated("setting [{}] is only allowed on index [{}] because it was created before 5.x; " + + "analyzer aliases can no longer be created on new indices.", analyzerAliasKey, index().getName()); + Set aliases = Sets.newHashSet(indexSettings.getSettings().getAsArray(analyzerAliasKey)); + for (String alias : aliases) { + if (analyzerAliases.putIfAbsent(alias, analyzer) != null) { + throw new IllegalStateException("alias [" + alias + "] is already used by [" + analyzerAliases.get(alias).name() + "]"); + } } } } @@ -174,6 +178,9 @@ public class AnalysisService extends AbstractIndexComponent implements Closeable } catch (NullPointerException e) { // because analyzers are aliased, they might be closed several times // an NPE is thrown in this case, so ignore.... + // TODO: Analyzer's can no longer have aliases in indices created in 5.x and beyond, + // so we only allow the aliases for analyzers on indices created pre 5.x for backwards + // compatibility. Once pre 5.0 indices are no longer supported, this check should be removed. } catch (Exception e) { logger.debug("failed to close analyzer {}", analyzer); } diff --git a/core/src/main/java/org/elasticsearch/node/Node.java b/core/src/main/java/org/elasticsearch/node/Node.java index 948dbc3bd85..955676b0166 100644 --- a/core/src/main/java/org/elasticsearch/node/Node.java +++ b/core/src/main/java/org/elasticsearch/node/Node.java @@ -108,7 +108,7 @@ import org.elasticsearch.search.SearchModule; import org.elasticsearch.search.SearchService; import org.elasticsearch.snapshots.SnapshotShardsService; import org.elasticsearch.snapshots.SnapshotsService; -import org.elasticsearch.tasks.TaskPersistenceService; +import org.elasticsearch.tasks.TaskResultsService; import org.elasticsearch.threadpool.ExecutorBuilder; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.transport.TransportService; @@ -466,7 +466,7 @@ public class Node implements Closeable { // Start the transport service now so the publish address will be added to the local disco node in ClusterService TransportService transportService = injector.getInstance(TransportService.class); - transportService.getTaskManager().setTaskResultsService(injector.getInstance(TaskPersistenceService.class)); + transportService.getTaskManager().setTaskResultsService(injector.getInstance(TaskResultsService.class)); transportService.start(); validateNodeBeforeAcceptingRequests(settings, transportService.boundAddress()); diff --git a/core/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java b/core/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java index 50ff0acb628..25dec47862b 100644 --- a/core/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java +++ b/core/src/main/java/org/elasticsearch/plugins/InstallPluginCommand.java @@ -143,8 +143,8 @@ class InstallPluginCommand extends SettingCommand { private final OptionSpec arguments; - public static final Set DIR_AND_EXECUTABLE_PERMS; - public static final Set FILE_PERMS; + static final Set DIR_AND_EXECUTABLE_PERMS; + static final Set FILE_PERMS; static { Set dirAndExecutablePerms = new HashSet<>(7); @@ -211,18 +211,13 @@ class InstallPluginCommand extends SettingCommand { final String url; final String stagingHash = System.getProperty(PROPERTY_STAGING_ID); if (stagingHash != null) { - url = String.format( - Locale.ROOT, - "https://download.elastic.co/elasticsearch/staging/%1$s-%2$s/org/elasticsearch/plugin/%3$s/%1$s/%3$s-%1$s.zip", - version, - stagingHash, - pluginId); + url = String.format(Locale.ROOT, + "https://staging.elastic.co/%1$s/download/elasticsearch-plugins/%2$s/%2$s-%3$s.zip", + stagingHash, pluginId, version); } else { - url = String.format( - Locale.ROOT, - "https://download.elastic.co/elasticsearch/release/org/elasticsearch/plugin/%1$s/%2$s/%1$s-%2$s.zip", - pluginId, - version); + url = String.format(Locale.ROOT, + "https://artifacts.elastic.co/download/elasticsearch-plugins/%1$s/%1$s-%2$s.zip", + pluginId, version); } terminal.println("-> Downloading " + pluginId + " from elastic"); return downloadZipAndChecksum(terminal, url, tmpDir); diff --git a/core/src/main/java/org/elasticsearch/rest/action/support/AcknowledgedRestListener.java b/core/src/main/java/org/elasticsearch/rest/action/AcknowledgedRestListener.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/support/AcknowledgedRestListener.java rename to core/src/main/java/org/elasticsearch/rest/action/AcknowledgedRestListener.java index 2f5223d91df..203c2eafc77 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/support/AcknowledgedRestListener.java +++ b/core/src/main/java/org/elasticsearch/rest/action/AcknowledgedRestListener.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.support; +package org.elasticsearch.rest.action; import org.elasticsearch.action.support.master.AcknowledgedResponse; import org.elasticsearch.common.xcontent.XContentBuilder; diff --git a/core/src/main/java/org/elasticsearch/rest/action/support/RestActionListener.java b/core/src/main/java/org/elasticsearch/rest/action/RestActionListener.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/support/RestActionListener.java rename to core/src/main/java/org/elasticsearch/rest/action/RestActionListener.java index 15b0736a790..5074a120791 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/support/RestActionListener.java +++ b/core/src/main/java/org/elasticsearch/rest/action/RestActionListener.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.support; +package org.elasticsearch.rest.action; import org.elasticsearch.action.ActionListener; import org.elasticsearch.common.logging.ESLogger; diff --git a/core/src/main/java/org/elasticsearch/rest/action/support/RestActions.java b/core/src/main/java/org/elasticsearch/rest/action/RestActions.java similarity index 99% rename from core/src/main/java/org/elasticsearch/rest/action/support/RestActions.java rename to core/src/main/java/org/elasticsearch/rest/action/RestActions.java index 66998ee8727..bb72e3e2249 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/support/RestActions.java +++ b/core/src/main/java/org/elasticsearch/rest/action/RestActions.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.support; +package org.elasticsearch.rest.action; import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ExceptionsHelper; diff --git a/core/src/main/java/org/elasticsearch/rest/action/support/RestBuilderListener.java b/core/src/main/java/org/elasticsearch/rest/action/RestBuilderListener.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/support/RestBuilderListener.java rename to core/src/main/java/org/elasticsearch/rest/action/RestBuilderListener.java index 82c72e59f9b..cc93e72d80d 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/support/RestBuilderListener.java +++ b/core/src/main/java/org/elasticsearch/rest/action/RestBuilderListener.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.support; +package org.elasticsearch.rest.action; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.RestChannel; diff --git a/core/src/main/java/org/elasticsearch/rest/action/fieldstats/RestFieldStatsAction.java b/core/src/main/java/org/elasticsearch/rest/action/RestFieldStatsAction.java similarity index 94% rename from core/src/main/java/org/elasticsearch/rest/action/fieldstats/RestFieldStatsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/RestFieldStatsAction.java index 9f62024ab80..e6ef620db10 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/fieldstats/RestFieldStatsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/RestFieldStatsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.fieldstats; +package org.elasticsearch.rest.action; import org.elasticsearch.action.fieldstats.FieldStats; import org.elasticsearch.action.fieldstats.FieldStatsRequest; @@ -35,14 +35,12 @@ 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.RestActions; -import org.elasticsearch.rest.action.support.RestBuilderListener; import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; -import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; +import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader; /** */ diff --git a/core/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java b/core/src/main/java/org/elasticsearch/rest/action/RestMainAction.java similarity index 96% rename from core/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java rename to core/src/main/java/org/elasticsearch/rest/action/RestMainAction.java index 24f4e66e7db..56053f414b0 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/main/RestMainAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/RestMainAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.main; +package org.elasticsearch.rest.action; import org.elasticsearch.action.main.MainAction; import org.elasticsearch.action.main.MainRequest; @@ -33,7 +33,6 @@ 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.io.IOException; diff --git a/core/src/main/java/org/elasticsearch/rest/action/support/RestResponseListener.java b/core/src/main/java/org/elasticsearch/rest/action/RestResponseListener.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/support/RestResponseListener.java rename to core/src/main/java/org/elasticsearch/rest/action/RestResponseListener.java index b5c9f2bcca8..0f6d442e8d0 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/support/RestResponseListener.java +++ b/core/src/main/java/org/elasticsearch/rest/action/RestResponseListener.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.support; +package org.elasticsearch.rest.action; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestResponse; diff --git a/core/src/main/java/org/elasticsearch/rest/action/support/RestStatusToXContentListener.java b/core/src/main/java/org/elasticsearch/rest/action/RestStatusToXContentListener.java similarity index 98% rename from core/src/main/java/org/elasticsearch/rest/action/support/RestStatusToXContentListener.java rename to core/src/main/java/org/elasticsearch/rest/action/RestStatusToXContentListener.java index f6c4f67bd81..f147d6bc00d 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/support/RestStatusToXContentListener.java +++ b/core/src/main/java/org/elasticsearch/rest/action/RestStatusToXContentListener.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.elasticsearch.rest.action.support; +package org.elasticsearch.rest.action; import org.elasticsearch.common.xcontent.StatusToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; diff --git a/core/src/main/java/org/elasticsearch/rest/action/support/RestToXContentListener.java b/core/src/main/java/org/elasticsearch/rest/action/RestToXContentListener.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/support/RestToXContentListener.java rename to core/src/main/java/org/elasticsearch/rest/action/RestToXContentListener.java index 055158f542c..9e5c4f40659 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/support/RestToXContentListener.java +++ b/core/src/main/java/org/elasticsearch/rest/action/RestToXContentListener.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.support; +package org.elasticsearch.rest.action; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java index 5ed865e2716..65786accd81 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCancelTasksAction.java @@ -31,7 +31,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.tasks.TaskId; import static org.elasticsearch.rest.RestRequest.Method.POST; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java index f615fd6cfae..bae1d1b6714 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterAllocationExplainAction.java @@ -40,8 +40,8 @@ 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.RestActions; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestBuilderListener; /** * Class handling cluster allocation explanation at the REST level diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java index 4a225687d7e..ca2cbaf79fa 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java @@ -37,7 +37,7 @@ 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 org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java index 12708b2e98b..0c23b5346db 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterHealthAction.java @@ -31,7 +31,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestStatusToXContentListener; +import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.util.Locale; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java index b70f8c70bf0..1a1e78b1720 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterRerouteAction.java @@ -43,7 +43,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import java.io.IOException; import java.util.EnumSet; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java index 96cf742844d..754b9b0d633 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterSearchShardsAction.java @@ -31,7 +31,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestToXContentListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java index c8799edea53..fab2ee0062f 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStateAction.java @@ -37,7 +37,7 @@ 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 org.elasticsearch.rest.action.RestBuilderListener; import java.util.EnumSet; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java index b1fee12d747..7ef05d04553 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterStatsAction.java @@ -27,7 +27,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions.NodesResponseRestListener; +import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener; /** * diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java index 1513f218239..8de725dbe79 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java @@ -32,7 +32,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import java.io.IOException; import java.util.Map; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java index be10ca94c7d..96449131a61 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestCreateSnapshotAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestToXContentListener; import static org.elasticsearch.client.Requests.createSnapshotRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java index 5576434602c..78d063bae00 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import static org.elasticsearch.client.Requests.deleteRepositoryRequest; import static org.elasticsearch.rest.RestRequest.Method.DELETE; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java index 1295a92555f..d001a1e90e5 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import static org.elasticsearch.client.Requests.deleteSnapshotRequest; import static org.elasticsearch.rest.RestRequest.Method.DELETE; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java index d3b1a21e6af..212b42135e9 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java @@ -26,7 +26,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import static org.elasticsearch.rest.RestRequest.Method.DELETE; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java index 91d810c5922..802af3cb5b8 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetRepositoriesAction.java @@ -35,7 +35,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import static org.elasticsearch.client.Requests.getRepositoryRequest; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java index dfec03c8cf6..9e10a87bc03 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetSnapshotsAction.java @@ -29,7 +29,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestToXContentListener; import static org.elasticsearch.client.Requests.getSnapshotsRequest; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java index 34009384591..1185685c49a 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetStoredScriptAction.java @@ -31,7 +31,7 @@ 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 org.elasticsearch.rest.action.RestBuilderListener; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java index 780a1d2ca40..f1edf672010 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestGetTaskAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.tasks.TaskId; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java index ff28d6331bb..13b97cb0942 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestListTasksAction.java @@ -32,7 +32,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.tasks.TaskId; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java index 487fe223d0d..87af57276c2 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesHotThreadsAction.java @@ -34,7 +34,7 @@ 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.RestResponseListener; +import org.elasticsearch.rest.action.RestResponseListener; /** diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java index eb6c449603e..c45709d07d5 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesInfoAction.java @@ -30,7 +30,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions.NodesResponseRestListener; +import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener; import java.util.Set; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java index e2ba5db66d2..be6847f1b52 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestNodesStatsAction.java @@ -30,7 +30,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions.NodesResponseRestListener; +import org.elasticsearch.rest.action.RestActions.NodesResponseRestListener; import java.util.Set; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java index 202bc2e60a5..d1cb65092ce 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java @@ -27,7 +27,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestToXContentListener; public class RestPendingClusterTasksAction extends BaseRestHandler { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java index 1dd61f9cace..002e1bfdc95 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutRepositoryAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import static org.elasticsearch.client.Requests.putRepositoryRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java index cfe3f357863..c5156c4cd09 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestPutStoredScriptAction.java @@ -26,7 +26,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java index 6265c441d0b..100866e02db 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestToXContentListener; import static org.elasticsearch.client.Requests.restoreSnapshotRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java index f03e12fcb0f..bd2fd54420f 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java @@ -29,7 +29,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestToXContentListener; import static org.elasticsearch.client.Requests.snapshotsStatusRequest; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java index 007e2fdcb64..85aac840777 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java @@ -27,7 +27,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestToXContentListener; import static org.elasticsearch.client.Requests.verifyRepositoryRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java index d1bc3e581c9..7801aad8e0b 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestAnalyzeAction.java @@ -33,8 +33,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestToXContentListener; import java.io.IOException; import java.util.ArrayList; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java index 8f2411ff87c..391eaa64d50 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestClearIndicesCacheAction.java @@ -35,14 +35,14 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestStatus.OK; -import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; +import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader; public class RestClearIndicesCacheAction extends BaseRestHandler { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java index 87688d0c73f..e5baa27f4ec 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCloseIndexAction.java @@ -30,7 +30,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; /** * diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java index a4c2356e414..524cd5feb26 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestCreateIndexAction.java @@ -30,7 +30,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import java.io.IOException; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java index 5547141b4fc..d3e07effc14 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexAction.java @@ -30,7 +30,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; /** * diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java index 193d149f4b9..425581fe927 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java @@ -26,7 +26,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; public class RestDeleteIndexTemplateAction extends BaseRestHandler { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java index e9beffb90ff..b963a805934 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestFlushAction.java @@ -33,12 +33,12 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestStatus.OK; -import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; +import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader; /** * diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java index 7a4febb5cee..c376866ad1e 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestForceMergeAction.java @@ -33,11 +33,11 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestStatus.OK; -import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; +import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader; /** * diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java index 772cb311cc6..4b58fd0f16c 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetAliasesAction.java @@ -37,7 +37,7 @@ 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 org.elasticsearch.rest.action.RestBuilderListener; import java.util.List; import java.util.Locale; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java index 496588ce8ed..fba4192d5d4 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetFieldMappingAction.java @@ -35,7 +35,7 @@ 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 org.elasticsearch.rest.action.RestBuilderListener; import java.util.Map; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java index 39fd3d9e991..ead04532590 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndexTemplateAction.java @@ -29,7 +29,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestStatus; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestToXContentListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java index 37d17b0b4c8..2ad6f245cf0 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetIndicesAction.java @@ -40,7 +40,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; import java.util.List; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java index 8fc56235093..b9c84729640 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetMappingAction.java @@ -39,7 +39,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.OK; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java index f361942a20f..936a96e035a 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestGetSettingsAction.java @@ -36,7 +36,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.OK; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestHeadIndexTemplateAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestHeadIndexTemplateAction.java index 6de2503d130..3480fbb9afc 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestHeadIndexTemplateAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestHeadIndexTemplateAction.java @@ -30,7 +30,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; +import org.elasticsearch.rest.action.RestResponseListener; import static org.elasticsearch.rest.RestRequest.Method.HEAD; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java index 88e52df1964..87d9eb671bd 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import static org.elasticsearch.rest.RestRequest.Method.DELETE; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java index d34de194ad5..62661ed5198 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndexPutAliasAction.java @@ -32,7 +32,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import java.util.Map; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java index fa727df4fc8..b404d61d238 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesAliasesAction.java @@ -32,7 +32,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import java.util.ArrayList; import java.util.List; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesExistsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesExistsAction.java index 8d41ba647f3..fa62a844356 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesExistsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesExistsAction.java @@ -33,7 +33,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; +import org.elasticsearch.rest.action.RestResponseListener; import static org.elasticsearch.rest.RestRequest.Method.HEAD; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java index be8a22454e1..db9de980c52 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesSegmentsAction.java @@ -33,11 +33,11 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.OK; -import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; +import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader; public class RestIndicesSegmentsAction extends BaseRestHandler { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java index 615c758bd5d..65c0dc8aa45 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesShardStoresAction.java @@ -34,7 +34,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.OK; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java index b9f146a1015..c7dd62688fa 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestIndicesStatsAction.java @@ -33,13 +33,13 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import java.util.Set; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.OK; -import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; +import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader; public class RestIndicesStatsAction extends BaseRestHandler { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java index 883a59b17a1..dd40705769f 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestOpenIndexAction.java @@ -30,7 +30,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; /** * diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java index bb7c99ec7b1..398eb62c1f1 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutIndexTemplateAction.java @@ -27,7 +27,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; /** * diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java index ad0c68a4610..3a582d0b0a9 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestPutMappingAction.java @@ -30,7 +30,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import static org.elasticsearch.client.Requests.putMappingRequest; import static org.elasticsearch.rest.RestRequest.Method.POST; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java index e2fa172eaa6..5dee73606fd 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRecoveryAction.java @@ -33,7 +33,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestStatus.OK; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java index 763274c19fb..54088a7ddb2 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRefreshAction.java @@ -33,12 +33,12 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestStatus.OK; -import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; +import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader; /** * diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java index 021eff9ea68..1433bc42571 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestRolloverIndexAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestToXContentListener; /** * diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestShrinkIndexAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestShrinkIndexAction.java index 11285238703..f04c9760a63 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestShrinkIndexAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestShrinkIndexAction.java @@ -30,7 +30,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import java.io.IOException; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java index b06d05cbd37..784a588db89 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestSyncedFlushAction.java @@ -33,7 +33,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestTypesExistsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestTypesExistsAction.java index b58daf63cb1..791fc0eee39 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestTypesExistsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestTypesExistsAction.java @@ -32,7 +32,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; +import org.elasticsearch.rest.action.RestResponseListener; import static org.elasticsearch.rest.RestRequest.Method.HEAD; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java index 1b8e242550a..0c1b535901e 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpdateSettingsAction.java @@ -29,7 +29,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; import java.util.Map; import java.util.Set; diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeAction.java index c6eb78a5275..e0659e1cf52 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestUpgradeAction.java @@ -35,14 +35,14 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import java.util.Map; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestStatus.OK; -import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; +import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader; public class RestUpgradeAction extends BaseRestHandler { diff --git a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java index bea47823ee5..7bf2a34ef63 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/admin/indices/RestValidateQueryAction.java @@ -37,15 +37,15 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestBuilderListener; import java.io.IOException; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestStatus.OK; -import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; +import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader; /** * diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/AbstractCatAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/AbstractCatAction.java index 6c6a4592a9f..8315e34d08e 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/AbstractCatAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/AbstractCatAction.java @@ -29,8 +29,8 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestStatus; -import static org.elasticsearch.rest.action.support.RestTable.buildHelpWidths; -import static org.elasticsearch.rest.action.support.RestTable.pad; +import static org.elasticsearch.rest.action.cat.RestTable.buildHelpWidths; +import static org.elasticsearch.rest.action.cat.RestTable.pad; /** * diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java index deb11b13cd3..82d59784fc9 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestAliasAction.java @@ -31,8 +31,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestResponseListener; import java.util.List; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java index 33a5841480c..7649d59af99 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestAllocationAction.java @@ -38,9 +38,8 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestActionListener; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestActionListener; +import org.elasticsearch.rest.action.RestResponseListener; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java index 27d29ed63b6..4faddc3168c 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestCountAction.java @@ -33,9 +33,8 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.search.builder.SearchSourceBuilder; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java index 36ce8247da8..fcdad0c3f7e 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestFielddataAction.java @@ -32,8 +32,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestResponseListener; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java index cd38e6591b6..cd226e28b56 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestHealthAction.java @@ -29,8 +29,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestResponseListener; import java.util.Locale; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java index e24c9d13aa6..3c65e32c746 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestIndicesAction.java @@ -43,9 +43,8 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestActionListener; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestActionListener; +import org.elasticsearch.rest.action.RestResponseListener; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java index 5edd764fd10..5902ba60e57 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestMasterAction.java @@ -31,8 +31,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestResponseListener; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java index e7d3b159189..5ab98316c7c 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestNodeAttrsAction.java @@ -36,9 +36,8 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestActionListener; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestActionListener; +import org.elasticsearch.rest.action.RestResponseListener; import java.util.Map; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java index 26536ab6003..2c1900feefa 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java @@ -58,9 +58,8 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestActionListener; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestActionListener; +import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.script.ScriptStats; import org.elasticsearch.search.suggest.completion.CompletionStats; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java index 341a8bd5f82..773c6d292b5 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestPendingClusterTasksAction.java @@ -30,8 +30,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestResponseListener; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java index 4850ff312c3..ef8385653f1 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestPluginsAction.java @@ -35,9 +35,8 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestActionListener; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestActionListener; +import org.elasticsearch.rest.action.RestResponseListener; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestRecoveryAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestRecoveryAction.java index a891bbc36f8..54861f4e817 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestRecoveryAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestRecoveryAction.java @@ -34,8 +34,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestResponseListener; import java.util.Comparator; import java.util.List; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java index 0b1580723b6..05130504e50 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestRepositoriesAction.java @@ -30,8 +30,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestResponseListener; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java index 95351e71352..d2b30c49ca9 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestSegmentsAction.java @@ -37,9 +37,8 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestActionListener; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestActionListener; +import org.elasticsearch.rest.action.RestResponseListener; import java.util.List; import java.util.Map; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java index a8b71250327..bcedf864368 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestShardsAction.java @@ -40,9 +40,8 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestActionListener; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestActionListener; +import org.elasticsearch.rest.action.RestResponseListener; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java index 025205174a8..021b00be24e 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestSnapshotAction.java @@ -31,8 +31,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.snapshots.SnapshotInfo; import org.elasticsearch.snapshots.SnapshotState; import org.joda.time.format.DateTimeFormat; diff --git a/core/src/main/java/org/elasticsearch/rest/action/support/RestTable.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestTable.java similarity index 99% rename from core/src/main/java/org/elasticsearch/rest/action/support/RestTable.java rename to core/src/main/java/org/elasticsearch/rest/action/cat/RestTable.java index 4ba0483ca49..78d30407ffc 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/support/RestTable.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestTable.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.support; +package org.elasticsearch.rest.action.cat; import org.elasticsearch.common.Booleans; import org.elasticsearch.common.Strings; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java index 57ceff75aea..99eee4e735a 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestTasksAction.java @@ -35,8 +35,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.tasks.TaskInfo; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java b/core/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java index dc8c2d773e3..6f3c5c11ce0 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/RestThreadPoolAction.java @@ -39,9 +39,8 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestActionListener; -import org.elasticsearch.rest.action.support.RestResponseListener; -import org.elasticsearch.rest.action.support.RestTable; +import org.elasticsearch.rest.action.RestActionListener; +import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.threadpool.ThreadPool; import org.elasticsearch.threadpool.ThreadPoolStats; diff --git a/core/src/main/java/org/elasticsearch/rest/action/cat/package-info.java b/core/src/main/java/org/elasticsearch/rest/action/cat/package-info.java new file mode 100644 index 00000000000..334f717016c --- /dev/null +++ b/core/src/main/java/org/elasticsearch/rest/action/cat/package-info.java @@ -0,0 +1,23 @@ +/* + * 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 actions that spit out tables of results. + */ +package org.elasticsearch.rest.action.cat; diff --git a/core/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java b/core/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java similarity index 96% rename from core/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java rename to core/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java index a5a9ec40344..f5dca3f22c9 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/bulk/RestBulkAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/document/RestBulkAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.bulk; +package org.elasticsearch.rest.action.document; import org.elasticsearch.action.bulk.BulkItemResponse; import org.elasticsearch.action.bulk.BulkRequest; @@ -36,7 +36,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestBuilderListener; import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; @@ -85,7 +85,8 @@ public class RestBulkAction extends BaseRestHandler { } bulkRequest.timeout(request.paramAsTime("timeout", BulkShardRequest.DEFAULT_TIMEOUT)); bulkRequest.setRefreshPolicy(request.param("refresh")); - bulkRequest.add(request.content(), defaultIndex, defaultType, defaultRouting, defaultFields, defaultPipeline, null, allowExplicitIndex); + bulkRequest.add(request.content(), defaultIndex, defaultType, defaultRouting, defaultFields, defaultPipeline, + null, allowExplicitIndex); client.bulk(bulkRequest, new RestBuilderListener(channel) { @Override diff --git a/core/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java b/core/src/main/java/org/elasticsearch/rest/action/document/RestCountAction.java similarity index 95% rename from core/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java rename to core/src/main/java/org/elasticsearch/rest/action/document/RestCountAction.java index d75bb7a0bac..e5ca6f2cadd 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/count/RestCountAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/document/RestCountAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.count; +package org.elasticsearch.rest.action.document; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchResponse; @@ -36,13 +36,13 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.search.builder.SearchSourceBuilder; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; -import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; +import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader; import static org.elasticsearch.search.internal.SearchContext.DEFAULT_TERMINATE_AFTER; /** diff --git a/core/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java b/core/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java similarity index 93% rename from core/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java rename to core/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java index 869dca8dce0..392cff7ffba 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/delete/RestDeleteAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/document/RestDeleteAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.delete; +package org.elasticsearch.rest.action.document; import org.elasticsearch.action.delete.DeleteRequest; import org.elasticsearch.action.support.ActiveShardCount; @@ -29,8 +29,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestStatusToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestStatusToXContentListener; import static org.elasticsearch.rest.RestRequest.Method.DELETE; diff --git a/core/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java b/core/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java similarity index 95% rename from core/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java rename to core/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java index c05e7cece24..8c782a8d128 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/get/RestGetAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/document/RestGetAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.get; +package org.elasticsearch.rest.action.document; import org.elasticsearch.action.get.GetRequest; import org.elasticsearch.action.get.GetResponse; @@ -33,17 +33,14 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; 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 RestGetAction extends BaseRestHandler { @Inject diff --git a/core/src/main/java/org/elasticsearch/rest/action/get/RestGetSourceAction.java b/core/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/get/RestGetSourceAction.java rename to core/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java index 2cb5fa330db..1ecfe317f4e 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/get/RestGetSourceAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/document/RestGetSourceAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.get; +package org.elasticsearch.rest.action.document; import org.elasticsearch.action.ActionRequestValidationException; import org.elasticsearch.action.get.GetRequest; @@ -32,7 +32,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; +import org.elasticsearch.rest.action.RestResponseListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import java.io.IOException; @@ -41,9 +41,6 @@ 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 RestGetSourceAction extends BaseRestHandler { @Inject diff --git a/core/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java b/core/src/main/java/org/elasticsearch/rest/action/document/RestHeadAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java rename to core/src/main/java/org/elasticsearch/rest/action/document/RestHeadAction.java index ca8900ab77f..9fb706bd8e6 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/get/RestHeadAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/document/RestHeadAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.get; +package org.elasticsearch.rest.action.document; import org.elasticsearch.action.get.GetRequest; import org.elasticsearch.action.get.GetResponse; @@ -32,7 +32,7 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestResponseListener; +import org.elasticsearch.rest.action.RestResponseListener; import static org.elasticsearch.rest.RestRequest.Method.HEAD; import static org.elasticsearch.rest.RestStatus.NOT_FOUND; diff --git a/core/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java b/core/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java similarity index 96% rename from core/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java rename to core/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java index ef5f02d4b16..6c9723b5b93 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/index/RestIndexAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/document/RestIndexAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.index; +package org.elasticsearch.rest.action.document; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.support.ActiveShardCount; @@ -31,8 +31,8 @@ import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestStatusToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; diff --git a/core/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java b/core/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java similarity index 91% rename from core/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java rename to core/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java index ce779fd5569..995c43059da 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/get/RestMultiGetAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/document/RestMultiGetAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.get; +package org.elasticsearch.rest.action.document; import org.elasticsearch.action.get.MultiGetRequest; import org.elasticsearch.action.get.MultiGetResponse; @@ -29,8 +29,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import static org.elasticsearch.rest.RestRequest.Method.GET; @@ -68,7 +68,8 @@ public class RestMultiGetAction extends BaseRestHandler { } FetchSourceContext defaultFetchSource = FetchSourceContext.parseFromRestRequest(request); - multiGetRequest.add(request.param("index"), request.param("type"), sFields, defaultFetchSource, request.param("routing"), RestActions.getRestContent(request), allowExplicitIndex); + multiGetRequest.add(request.param("index"), request.param("type"), sFields, defaultFetchSource, + request.param("routing"), RestActions.getRestContent(request), allowExplicitIndex); client.multiGet(multiGetRequest, new RestToXContentListener(channel)); } diff --git a/core/src/main/java/org/elasticsearch/rest/action/termvectors/RestMultiTermVectorsAction.java b/core/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java similarity index 94% rename from core/src/main/java/org/elasticsearch/rest/action/termvectors/RestMultiTermVectorsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java index 888d854f40c..dab23e8df35 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/termvectors/RestMultiTermVectorsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/document/RestMultiTermVectorsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.termvectors; +package org.elasticsearch.rest.action.document; import org.elasticsearch.action.termvectors.MultiTermVectorsRequest; import org.elasticsearch.action.termvectors.MultiTermVectorsResponse; @@ -30,8 +30,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestToXContentListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; diff --git a/core/src/main/java/org/elasticsearch/rest/action/termvectors/RestTermVectorsAction.java b/core/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java similarity index 95% rename from core/src/main/java/org/elasticsearch/rest/action/termvectors/RestTermVectorsAction.java rename to core/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java index 30ee18300b1..b64219215a9 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/termvectors/RestTermVectorsAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/document/RestTermVectorsAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.termvectors; +package org.elasticsearch.rest.action.document; import org.elasticsearch.action.termvectors.TermVectorsRequest; import org.elasticsearch.action.termvectors.TermVectorsResponse; @@ -32,8 +32,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestToXContentListener; import java.util.HashSet; import java.util.Set; @@ -66,7 +66,8 @@ public class RestTermVectorsAction extends BaseRestHandler { public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws Exception { TermVectorsRequest termVectorsRequest = new TermVectorsRequest(request.param("index"), request.param("type"), request.param("id")); if (RestActions.hasBodyContent(request)) { - try (XContentParser parser = XContentFactory.xContent(RestActions.guessBodyContentType(request)).createParser(RestActions.getRestContent(request))){ + try (XContentParser parser = XContentFactory.xContent(RestActions.guessBodyContentType(request)) + .createParser(RestActions.getRestContent(request))){ TermVectorsRequest.parseRequest(termVectorsRequest, parser); } } diff --git a/core/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java b/core/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java similarity index 96% rename from core/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java rename to core/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java index 5fbdd29f963..d0d7916adfe 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/update/RestUpdateAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/document/RestUpdateAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.update; +package org.elasticsearch.rest.action.document; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.support.ActiveShardCount; @@ -31,8 +31,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestStatusToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestStatusToXContentListener; import static org.elasticsearch.rest.RestRequest.Method.POST; diff --git a/core/src/main/java/org/elasticsearch/rest/action/document/package-info.java b/core/src/main/java/org/elasticsearch/rest/action/document/package-info.java new file mode 100644 index 00000000000..724bd129dea --- /dev/null +++ b/core/src/main/java/org/elasticsearch/rest/action/document/package-info.java @@ -0,0 +1,23 @@ +/* + * 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 actions that can be taken on documents like index, update, get, and delete. + */ +package org.elasticsearch.rest.action.document; diff --git a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java index 7c6200ee97c..593b55b8b75 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestDeletePipelineAction.java @@ -27,7 +27,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; +import org.elasticsearch.rest.action.AcknowledgedRestListener; public class RestDeletePipelineAction extends BaseRestHandler { diff --git a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java index 2b7adedcacf..308fb146c30 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestGetPipelineAction.java @@ -28,7 +28,7 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestStatusToXContentListener; +import org.elasticsearch.rest.action.RestStatusToXContentListener; public class RestGetPipelineAction extends BaseRestHandler { diff --git a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java index 7d7080e8775..b6d34a6c254 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestPutPipelineAction.java @@ -27,8 +27,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.AcknowledgedRestListener; -import org.elasticsearch.rest.action.support.RestActions; +import org.elasticsearch.rest.action.AcknowledgedRestListener; +import org.elasticsearch.rest.action.RestActions; public class RestPutPipelineAction extends BaseRestHandler { diff --git a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java index 35ba1367e63..a51bdf5fef2 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/ingest/RestSimulatePipelineAction.java @@ -27,9 +27,9 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestStatusToXContentListener; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestStatusToXContentListener; +import org.elasticsearch.rest.action.RestToXContentListener; public class RestSimulatePipelineAction extends BaseRestHandler { diff --git a/core/src/main/java/org/elasticsearch/rest/action/ingest/package-info.java b/core/src/main/java/org/elasticsearch/rest/action/ingest/package-info.java new file mode 100644 index 00000000000..4bf1cfd404b --- /dev/null +++ b/core/src/main/java/org/elasticsearch/rest/action/ingest/package-info.java @@ -0,0 +1,23 @@ +/* + * 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 that manage ingest pipelines. + */ +package org.elasticsearch.rest.action.ingest; diff --git a/core/src/main/java/org/elasticsearch/rest/action/package-info.java b/core/src/main/java/org/elasticsearch/rest/action/package-info.java new file mode 100644 index 00000000000..d6f6b288657 --- /dev/null +++ b/core/src/main/java/org/elasticsearch/rest/action/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 that translate requests from REST into internal requests and start them then wait for them to + * complete and then translate them back into REST. And some classes to support them. + */ +package org.elasticsearch.rest.action; diff --git a/core/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java b/core/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java index b057844521c..4c8f84a2223 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/search/RestClearScrollAction.java @@ -33,16 +33,14 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestStatusToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestStatusToXContentListener; import java.io.IOException; import java.util.Arrays; import static org.elasticsearch.rest.RestRequest.Method.DELETE; -/** - */ public class RestClearScrollAction extends BaseRestHandler { @Inject @@ -98,7 +96,8 @@ public class RestClearScrollAction extends BaseRestHandler { clearScrollRequest.addScrollId(parser.text()); } } 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/explain/RestExplainAction.java b/core/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java similarity index 97% rename from core/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java rename to core/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java index 164e3e2a5f6..7088b96c6de 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/explain/RestExplainAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/search/RestExplainAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.explain; +package org.elasticsearch.rest.action.search; import org.apache.lucene.search.Explanation; import org.elasticsearch.action.explain.ExplainRequest; @@ -37,8 +37,8 @@ import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestResponse; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import java.io.IOException; diff --git a/core/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java b/core/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java index 52965193a2e..a2cc4ce1b7f 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/search/RestMultiSearchAction.java @@ -38,8 +38,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.search.aggregations.AggregatorParsers; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.suggest.Suggesters; diff --git a/core/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java b/core/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java index 7a73d306221..989e6ed4408 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/search/RestSearchAction.java @@ -38,8 +38,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestStatusToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.search.Scroll; import org.elasticsearch.search.aggregations.AggregatorParsers; import org.elasticsearch.search.builder.SearchSourceBuilder; diff --git a/core/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java b/core/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java index 45c938381b4..9b9ddd3a93d 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/search/RestSearchScrollAction.java @@ -34,8 +34,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestStatusToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.search.Scroll; import java.io.IOException; @@ -44,9 +44,6 @@ import static org.elasticsearch.common.unit.TimeValue.parseTimeValue; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; -/** - * - */ public class RestSearchScrollAction extends BaseRestHandler { @Inject @@ -99,7 +96,8 @@ public class RestSearchScrollAction extends BaseRestHandler { } else if ("scroll".equals(currentFieldName) && token == XContentParser.Token.VALUE_STRING) { searchScrollRequest.scroll(new Scroll(TimeValue.parseTimeValue(parser.text(), null, "scroll"))); } 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/suggest/RestSuggestAction.java b/core/src/main/java/org/elasticsearch/rest/action/search/RestSuggestAction.java similarity index 91% rename from core/src/main/java/org/elasticsearch/rest/action/suggest/RestSuggestAction.java rename to core/src/main/java/org/elasticsearch/rest/action/search/RestSuggestAction.java index f6acfc6daf5..62db8c3786c 100644 --- a/core/src/main/java/org/elasticsearch/rest/action/suggest/RestSuggestAction.java +++ b/core/src/main/java/org/elasticsearch/rest/action/search/RestSuggestAction.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.suggest; +package org.elasticsearch.rest.action.search; import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchResponse; @@ -39,8 +39,8 @@ 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.RestActions; -import org.elasticsearch.rest.action.support.RestBuilderListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestBuilderListener; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.suggest.Suggest; import org.elasticsearch.search.suggest.SuggestBuilder; @@ -50,11 +50,8 @@ import java.io.IOException; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; -import static org.elasticsearch.rest.action.support.RestActions.buildBroadcastShardsHeader; +import static org.elasticsearch.rest.action.RestActions.buildBroadcastShardsHeader; -/** - * - */ public class RestSuggestAction extends BaseRestHandler { private final IndicesQueriesRegistry queryRegistry; @@ -74,7 +71,8 @@ public class RestSuggestAction extends BaseRestHandler { @Override public void handleRequest(final RestRequest request, final RestChannel channel, final NodeClient client) throws IOException { - final SearchRequest searchRequest = new SearchRequest(Strings.splitStringByCommaToArray(request.param("index")), new SearchSourceBuilder()); + final SearchRequest searchRequest = new SearchRequest( + Strings.splitStringByCommaToArray(request.param("index")), new SearchSourceBuilder()); searchRequest.indicesOptions(IndicesOptions.fromRequest(request, searchRequest.indicesOptions())); if (RestActions.hasBodyContent(request)) { final BytesReference sourceBytes = RestActions.getRestContent(request); diff --git a/core/src/main/java/org/elasticsearch/rest/action/search/package-info.java b/core/src/main/java/org/elasticsearch/rest/action/search/package-info.java new file mode 100644 index 00000000000..6758eec2f76 --- /dev/null +++ b/core/src/main/java/org/elasticsearch/rest/action/search/package-info.java @@ -0,0 +1,23 @@ +/* + * 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 search actions like search, scroll, and suggest. + */ +package org.elasticsearch.rest.action.search; diff --git a/core/src/main/java/org/elasticsearch/rest/package-info.java b/core/src/main/java/org/elasticsearch/rest/package-info.java new file mode 100644 index 00000000000..7e1f27d6df6 --- /dev/null +++ b/core/src/main/java/org/elasticsearch/rest/package-info.java @@ -0,0 +1,23 @@ +/* + * 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. + */ + +/** + * Exposes Elasticsearch functionality over RESTful HTTP. + */ +package org.elasticsearch.rest; diff --git a/core/src/main/java/org/elasticsearch/search/Scroll.java b/core/src/main/java/org/elasticsearch/search/Scroll.java index 13298b2cbbe..d4cd7cb8030 100644 --- a/core/src/main/java/org/elasticsearch/search/Scroll.java +++ b/core/src/main/java/org/elasticsearch/search/Scroll.java @@ -21,10 +21,11 @@ package org.elasticsearch.search; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; -import org.elasticsearch.common.io.stream.Streamable; +import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.unit.TimeValue; import java.io.IOException; +import java.util.Objects; /** * A scroll enables scrolling of search request. It holds a {@link #keepAlive()} time that @@ -32,19 +33,19 @@ import java.io.IOException; * * */ -public class Scroll implements Streamable { +public final class Scroll implements Writeable { - private TimeValue keepAlive; - - private Scroll() { + private final TimeValue keepAlive; + public Scroll(StreamInput in) throws IOException { + this.keepAlive = new TimeValue(in); } /** * Constructs a new scroll of the provided keep alive. */ public Scroll(TimeValue keepAlive) { - this.keepAlive = keepAlive; + this.keepAlive = Objects.requireNonNull(keepAlive, "keepAlive must not be null"); } /** @@ -54,19 +55,30 @@ public class Scroll implements Streamable { return keepAlive; } - public static Scroll readScroll(StreamInput in) throws IOException { - Scroll scroll = new Scroll(); - scroll.readFrom(in); - return scroll; - } - - @Override - public void readFrom(StreamInput in) throws IOException { - in.readOptionalWriteable(TimeValue::new); - } - @Override public void writeTo(StreamOutput out) throws IOException { - out.writeOptionalWriteable(keepAlive); + keepAlive.writeTo(out); + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Scroll scroll = (Scroll) o; + return Objects.equals(keepAlive, scroll.keepAlive); + } + + @Override + public int hashCode() { + return Objects.hash(keepAlive); + } + + @Override + public String toString() { + return "Scroll{keepAlive=" + keepAlive + '}'; } } diff --git a/core/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java b/core/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java index 7f918138045..82a74de73d2 100644 --- a/core/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java +++ b/core/src/main/java/org/elasticsearch/search/internal/InternalScrollSearchRequest.java @@ -27,11 +27,6 @@ import org.elasticsearch.transport.TransportRequest; import java.io.IOException; -import static org.elasticsearch.search.Scroll.readScroll; - -/** - * - */ public class InternalScrollSearchRequest extends TransportRequest { private long id; @@ -63,20 +58,13 @@ public class InternalScrollSearchRequest extends TransportRequest { public void readFrom(StreamInput in) throws IOException { super.readFrom(in); id = in.readLong(); - if (in.readBoolean()) { - scroll = readScroll(in); - } + scroll = in.readOptionalWriteable(Scroll::new); } @Override public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeLong(id); - if (scroll == null) { - out.writeBoolean(false); - } else { - out.writeBoolean(true); - scroll.writeTo(out); - } + out.writeOptionalWriteable(scroll); } } diff --git a/core/src/main/java/org/elasticsearch/search/internal/ShardSearchLocalRequest.java b/core/src/main/java/org/elasticsearch/search/internal/ShardSearchLocalRequest.java index f70835e0a99..d025d573c14 100644 --- a/core/src/main/java/org/elasticsearch/search/internal/ShardSearchLocalRequest.java +++ b/core/src/main/java/org/elasticsearch/search/internal/ShardSearchLocalRequest.java @@ -35,8 +35,6 @@ import org.elasticsearch.search.builder.SearchSourceBuilder; import java.io.IOException; -import static org.elasticsearch.search.Scroll.readScroll; - /** * Shard level search request that gets created and consumed on the local node. * Used by warmers and by api that need to create a search context within their execution. @@ -168,12 +166,8 @@ public class ShardSearchLocalRequest implements ShardSearchRequest { shardId = ShardId.readShardId(in); searchType = SearchType.fromId(in.readByte()); numberOfShards = in.readVInt(); - if (in.readBoolean()) { - scroll = readScroll(in); - } - if (in.readBoolean()) { - source = new SearchSourceBuilder(in); - } + scroll = in.readOptionalWriteable(Scroll::new); + source = in.readOptionalWriteable(SearchSourceBuilder::new); types = in.readStringArray(); filteringAliases = in.readStringArray(); nowInMillis = in.readVLong(); @@ -186,19 +180,8 @@ public class ShardSearchLocalRequest implements ShardSearchRequest { if (!asKey) { out.writeVInt(numberOfShards); } - if (scroll == null) { - out.writeBoolean(false); - } else { - out.writeBoolean(true); - scroll.writeTo(out); - } - if (source == null) { - out.writeBoolean(false); - } else { - out.writeBoolean(true); - source.writeTo(out); - - } + out.writeOptionalWriteable(scroll); + out.writeOptionalWriteable(source); out.writeStringArray(types); out.writeStringArrayNullable(filteringAliases); if (!asKey) { diff --git a/core/src/main/java/org/elasticsearch/tasks/Task.java b/core/src/main/java/org/elasticsearch/tasks/Task.java index 93fee29d249..53e5855c025 100644 --- a/core/src/main/java/org/elasticsearch/tasks/Task.java +++ b/core/src/main/java/org/elasticsearch/tasks/Task.java @@ -135,15 +135,15 @@ public class Task { public interface Status extends ToXContent, NamedWriteable {} - public PersistedTaskInfo result(DiscoveryNode node, Exception error) throws IOException { - return new PersistedTaskInfo(taskInfo(node, true), error); + public TaskResult result(DiscoveryNode node, Exception error) throws IOException { + return new TaskResult(taskInfo(node, true), error); } - public PersistedTaskInfo result(DiscoveryNode node, ActionResponse response) throws IOException { + public TaskResult result(DiscoveryNode node, ActionResponse response) throws IOException { if (response instanceof ToXContent) { - return new PersistedTaskInfo(taskInfo(node, true), (ToXContent) response); + return new TaskResult(taskInfo(node, true), (ToXContent) response); } else { - throw new IllegalStateException("response has to implement ToXContent for persistence"); + throw new IllegalStateException("response has to implement ToXContent to be able to store the results"); } } } diff --git a/core/src/main/java/org/elasticsearch/tasks/TaskInfo.java b/core/src/main/java/org/elasticsearch/tasks/TaskInfo.java index 1bd5f1bfc6a..271586779e2 100644 --- a/core/src/main/java/org/elasticsearch/tasks/TaskInfo.java +++ b/core/src/main/java/org/elasticsearch/tasks/TaskInfo.java @@ -207,7 +207,7 @@ public final class TaskInfo implements Writeable, ToXContent { return new TaskInfo(id, type, action, description, status, startTime, runningTimeNanos, cancellable, parentTaskId); }); static { - // Note for the future: this has to be backwards compatible with all changes to the task persistence format + // Note for the future: this has to be backwards compatible with all changes to the task storage format PARSER.declareString(constructorArg(), new ParseField("node")); PARSER.declareLong(constructorArg(), new ParseField("id")); PARSER.declareString(constructorArg(), new ParseField("type")); diff --git a/core/src/main/java/org/elasticsearch/tasks/TaskManager.java b/core/src/main/java/org/elasticsearch/tasks/TaskManager.java index a6724d16f25..f0fea6aa2a1 100644 --- a/core/src/main/java/org/elasticsearch/tasks/TaskManager.java +++ b/core/src/main/java/org/elasticsearch/tasks/TaskManager.java @@ -63,7 +63,7 @@ public class TaskManager extends AbstractComponent implements ClusterStateListen private final Map banedParents = new ConcurrentHashMap<>(); - private TaskPersistenceService taskResultsService; + private TaskResultsService taskResultsService; private DiscoveryNodes lastDiscoveryNodes = DiscoveryNodes.EMPTY_NODES; @@ -71,7 +71,7 @@ public class TaskManager extends AbstractComponent implements ClusterStateListen super(settings); } - public void setTaskResultsService(TaskPersistenceService taskResultsService) { + public void setTaskResultsService(TaskResultsService taskResultsService) { assert this.taskResultsService == null; this.taskResultsService = taskResultsService; } @@ -155,22 +155,22 @@ public class TaskManager extends AbstractComponent implements ClusterStateListen /** * Stores the task failure */ - public void persistResult(Task task, Exception error, ActionListener listener) { + public void storeResult(Task task, Exception error, ActionListener listener) { DiscoveryNode localNode = lastDiscoveryNodes.getLocalNode(); if (localNode == null) { - // too early to persist anything, shouldn't really be here - just pass the error along + // too early to store anything, shouldn't really be here - just pass the error along listener.onFailure(error); return; } - final PersistedTaskInfo taskResult; + final TaskResult taskResult; try { taskResult = task.result(localNode, error); } catch (IOException ex) { - logger.warn("couldn't persist error {}", ex, ExceptionsHelper.detailedMessage(error)); + logger.warn("couldn't store error {}", ex, ExceptionsHelper.detailedMessage(error)); listener.onFailure(ex); return; } - taskResultsService.persist(taskResult, new ActionListener() { + taskResultsService.storeResult(taskResult, new ActionListener() { @Override public void onResponse(Void aVoid) { listener.onFailure(error); @@ -178,7 +178,7 @@ public class TaskManager extends AbstractComponent implements ClusterStateListen @Override public void onFailure(Exception e) { - logger.warn("couldn't persist error {}", e, ExceptionsHelper.detailedMessage(error)); + logger.warn("couldn't store error {}", e, ExceptionsHelper.detailedMessage(error)); listener.onFailure(e); } }); @@ -187,24 +187,24 @@ public class TaskManager extends AbstractComponent implements ClusterStateListen /** * Stores the task result */ - public void persistResult(Task task, Response response, ActionListener listener) { + public void storeResult(Task task, Response response, ActionListener listener) { DiscoveryNode localNode = lastDiscoveryNodes.getLocalNode(); if (localNode == null) { - // too early to persist anything, shouldn't really be here - just pass the response along - logger.warn("couldn't persist response {}, the node didn't join the cluster yet", response); + // too early to store anything, shouldn't really be here - just pass the response along + logger.warn("couldn't store response {}, the node didn't join the cluster yet", response); listener.onResponse(response); return; } - final PersistedTaskInfo taskResult; + final TaskResult taskResult; try { taskResult = task.result(localNode, response); } catch (IOException ex) { - logger.warn("couldn't persist response {}", ex, response); + logger.warn("couldn't store response {}", ex, response); listener.onFailure(ex); return; } - taskResultsService.persist(taskResult, new ActionListener() { + taskResultsService.storeResult(taskResult, new ActionListener() { @Override public void onResponse(Void aVoid) { listener.onResponse(response); @@ -212,7 +212,7 @@ public class TaskManager extends AbstractComponent implements ClusterStateListen @Override public void onFailure(Exception e) { - logger.warn("couldn't persist response {}", e, response); + logger.warn("couldn't store response {}", e, response); listener.onFailure(e); } }); diff --git a/core/src/main/java/org/elasticsearch/tasks/PersistedTaskInfo.java b/core/src/main/java/org/elasticsearch/tasks/TaskResult.java similarity index 83% rename from core/src/main/java/org/elasticsearch/tasks/PersistedTaskInfo.java rename to core/src/main/java/org/elasticsearch/tasks/TaskResult.java index ceea2774419..b5918ad9593 100644 --- a/core/src/main/java/org/elasticsearch/tasks/PersistedTaskInfo.java +++ b/core/src/main/java/org/elasticsearch/tasks/TaskResult.java @@ -45,10 +45,10 @@ import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optiona import static org.elasticsearch.common.xcontent.XContentHelper.convertToMap; /** - * Information about a persisted or running task. Running tasks just have a {@link #getTask()} while persisted tasks will have either a - * {@link #getError()} or {@link #getResponse()}. + * Information about a running task or a task that stored its result. Running tasks just have a {@link #getTask()} while + * tasks with stored result will have either a {@link #getError()} or {@link #getResponse()}. */ -public final class PersistedTaskInfo implements Writeable, ToXContent { +public final class TaskResult implements Writeable, ToXContent { private final boolean completed; private final TaskInfo task; @Nullable @@ -57,28 +57,28 @@ public final class PersistedTaskInfo implements Writeable, ToXContent { private final BytesReference response; /** - * Construct a {@linkplain PersistedTaskInfo} for a task for which we don't have a result or error. That usually means that the task + * Construct a {@linkplain TaskResult} for a task for which we don't have a result or error. That usually means that the task * is incomplete, but it could also mean that we waited for the task to complete but it didn't save any error information. */ - public PersistedTaskInfo(boolean completed, TaskInfo task) { + public TaskResult(boolean completed, TaskInfo task) { this(completed, task, null, null); } /** - * Construct a {@linkplain PersistedTaskInfo} for a task that completed with an error. + * Construct a {@linkplain TaskResult} for a task that completed with an error. */ - public PersistedTaskInfo(TaskInfo task, Exception error) throws IOException { + public TaskResult(TaskInfo task, Exception error) throws IOException { this(true, task, toXContent(error), null); } /** - * Construct a {@linkplain PersistedTaskInfo} for a task that completed successfully. + * Construct a {@linkplain TaskResult} for a task that completed successfully. */ - public PersistedTaskInfo(TaskInfo task, ToXContent response) throws IOException { + public TaskResult(TaskInfo task, ToXContent response) throws IOException { this(true, task, null, toXContent(response)); } - private PersistedTaskInfo(boolean completed, TaskInfo task, @Nullable BytesReference error, @Nullable BytesReference result) { + private TaskResult(boolean completed, TaskInfo task, @Nullable BytesReference error, @Nullable BytesReference result) { this.completed = completed; this.task = requireNonNull(task, "task is required"); this.error = error; @@ -88,7 +88,7 @@ public final class PersistedTaskInfo implements Writeable, ToXContent { /** * Read from a stream. */ - public PersistedTaskInfo(StreamInput in) throws IOException { + public TaskResult(StreamInput in) throws IOException { completed = in.readBoolean(); task = new TaskInfo(in); error = in.readOptionalBytesReference(); @@ -112,7 +112,7 @@ public final class PersistedTaskInfo implements Writeable, ToXContent { /** * Get the error that finished this task. Will return null if the task didn't finish with an error, it hasn't yet finished, or didn't - * persist its result. + * store its result. */ public BytesReference getError() { return error; @@ -120,7 +120,7 @@ public final class PersistedTaskInfo implements Writeable, ToXContent { /** * Convert {@link #getError()} from XContent to a Map for easy processing. Will return an empty map if the task didn't finish with an - * error, hasn't yet finished, or didn't persist its result. + * error, hasn't yet finished, or didn't store its result. */ public Map getErrorAsMap() { if (error == null) { @@ -131,7 +131,7 @@ public final class PersistedTaskInfo implements Writeable, ToXContent { /** * Get the response that this task finished with. Will return null if the task was finished by an error, it hasn't yet finished, or - * didn't persist its result. + * didn't store its result. */ public BytesReference getResponse() { return response; @@ -139,7 +139,7 @@ public final class PersistedTaskInfo implements Writeable, ToXContent { /** * Convert {@link #getResponse()} from XContent to a Map for easy processing. Will return an empty map if the task was finished with an - * error, hasn't yet finished, or didn't persist its result. + * error, hasn't yet finished, or didn't store its result. */ public Map getResponseAsMap() { if (response == null) { @@ -171,14 +171,14 @@ public final class PersistedTaskInfo implements Writeable, ToXContent { return builder; } - public static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( - "persisted_task_info", a -> { + public static final ConstructingObjectParser PARSER = new ConstructingObjectParser<>( + "stored_task_result", a -> { int i = 0; boolean completed = (boolean) a[i++]; TaskInfo task = (TaskInfo) a[i++]; BytesReference error = (BytesReference) a[i++]; BytesReference response = (BytesReference) a[i++]; - return new PersistedTaskInfo(completed, task, error, response); + return new TaskResult(completed, task, error, response); }); static { PARSER.declareBoolean(constructorArg(), new ParseField("completed")); @@ -195,10 +195,10 @@ public final class PersistedTaskInfo implements Writeable, ToXContent { // Implements equals and hashcode for testing @Override public boolean equals(Object obj) { - if (obj == null || obj.getClass() != PersistedTaskInfo.class) { + if (obj == null || obj.getClass() != TaskResult.class) { return false; } - PersistedTaskInfo other = (PersistedTaskInfo) obj; + TaskResult other = (TaskResult) obj; /* * Equality of error and result is done by converting them to a map first. Not efficient but ignores field order and spacing * differences so perfect for testing. diff --git a/core/src/main/java/org/elasticsearch/tasks/TaskPersistenceService.java b/core/src/main/java/org/elasticsearch/tasks/TaskResultsService.java similarity index 91% rename from core/src/main/java/org/elasticsearch/tasks/TaskPersistenceService.java rename to core/src/main/java/org/elasticsearch/tasks/TaskResultsService.java index 992a7de4b72..4b68e8af97a 100644 --- a/core/src/main/java/org/elasticsearch/tasks/TaskPersistenceService.java +++ b/core/src/main/java/org/elasticsearch/tasks/TaskResultsService.java @@ -47,9 +47,9 @@ import java.io.IOException; import java.io.InputStream; /** - * Service that can persist tasks and their results. + * Service that can store task results. */ -public class TaskPersistenceService extends AbstractComponent { +public class TaskResultsService extends AbstractComponent { public static final String TASK_INDEX = ".tasks"; @@ -64,7 +64,7 @@ public class TaskPersistenceService extends AbstractComponent { private final TransportCreateIndexAction createIndexAction; @Inject - public TaskPersistenceService(Settings settings, Client client, ClusterService clusterService, + public TaskResultsService(Settings settings, Client client, ClusterService clusterService, TransportCreateIndexAction createIndexAction) { super(settings); this.client = client; @@ -72,7 +72,7 @@ public class TaskPersistenceService extends AbstractComponent { this.createIndexAction = createIndexAction; } - public void persist(PersistedTaskInfo taskResult, ActionListener listener) { + public void storeResult(TaskResult taskResult, ActionListener listener) { ClusterState state = clusterService.state(); @@ -86,7 +86,7 @@ public class TaskPersistenceService extends AbstractComponent { createIndexAction.execute(null, createIndexRequest, new ActionListener() { @Override public void onResponse(CreateIndexResponse result) { - doPersist(taskResult, listener); + doStoreResult(taskResult, listener); } @Override @@ -94,7 +94,7 @@ public class TaskPersistenceService extends AbstractComponent { if (ExceptionsHelper.unwrapCause(e) instanceof IndexAlreadyExistsException) { // we have the index, do it try { - doPersist(taskResult, listener); + doStoreResult(taskResult, listener); } catch (Exception inner) { inner.addSuppressed(e); listener.onFailure(inner); @@ -112,7 +112,7 @@ public class TaskPersistenceService extends AbstractComponent { .execute(new ActionListener() { @Override public void onResponse(PutMappingResponse putMappingResponse) { - doPersist(taskResult, listener); + doStoreResult(taskResult, listener); } @Override @@ -122,13 +122,13 @@ public class TaskPersistenceService extends AbstractComponent { } ); } else { - doPersist(taskResult, listener); + doStoreResult(taskResult, listener); } } } - private void doPersist(PersistedTaskInfo taskResult, ActionListener listener) { + private void doStoreResult(TaskResult taskResult, ActionListener listener) { IndexRequestBuilder index = client.prepareIndex(TASK_INDEX, TASK_TYPE, taskResult.getTask().getTaskId().toString()); try (XContentBuilder builder = XContentFactory.contentBuilder(Requests.INDEX_CONTENT_TYPE)) { taskResult.toXContent(builder, ToXContent.EMPTY_PARAMS); diff --git a/core/src/test/java/org/elasticsearch/action/ActionModuleTests.java b/core/src/test/java/org/elasticsearch/action/ActionModuleTests.java index 87c1a227328..2c17cea5ef5 100644 --- a/core/src/test/java/org/elasticsearch/action/ActionModuleTests.java +++ b/core/src/test/java/org/elasticsearch/action/ActionModuleTests.java @@ -31,7 +31,7 @@ import org.elasticsearch.plugins.ActionPlugin.ActionHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestHandler; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.main.RestMainAction; +import org.elasticsearch.rest.action.RestMainAction; import org.elasticsearch.tasks.TaskManager; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.threadpool.ThreadPool; diff --git a/core/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TasksIT.java b/core/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TasksIT.java index 074daca7700..a7234b20ab5 100644 --- a/core/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TasksIT.java +++ b/core/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TasksIT.java @@ -46,11 +46,11 @@ import org.elasticsearch.common.settings.Settings; import org.elasticsearch.index.query.QueryBuilders; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.tasks.PersistedTaskInfo; +import org.elasticsearch.tasks.TaskResult; import org.elasticsearch.tasks.Task; import org.elasticsearch.tasks.TaskId; import org.elasticsearch.tasks.TaskInfo; -import org.elasticsearch.tasks.TaskPersistenceService; +import org.elasticsearch.tasks.TaskResultsService; import org.elasticsearch.test.ESIntegTestCase; import org.elasticsearch.test.tasks.MockTaskManager; import org.elasticsearch.test.tasks.MockTaskManagerListener; @@ -452,39 +452,39 @@ public class TasksIT extends ESIntegTestCase { }); } - public void testGetTaskWaitForCompletionNoPersist() throws Exception { + public void testGetTaskWaitForCompletionWithoutStoringResult() throws Exception { waitForCompletionTestCase(false, id -> { return client().admin().cluster().prepareGetTask(id).setWaitForCompletion(true).execute(); }, response -> { assertNotNull(response.getTask().getTask()); assertTrue(response.getTask().isCompleted()); - // We didn't persist the result so it won't come back when we wait + // We didn't store the result so it won't come back when we wait assertNull(response.getTask().getResponse()); }); } - public void testGetTaskWaitForCompletionWithPersist() throws Exception { + public void testGetTaskWaitForCompletionWithStoringResult() throws Exception { waitForCompletionTestCase(true, id -> { return client().admin().cluster().prepareGetTask(id).setWaitForCompletion(true).execute(); }, response -> { assertNotNull(response.getTask().getTask()); assertTrue(response.getTask().isCompleted()); - // We persisted the task so we should get its results + // We stored the task so we should get its results assertEquals(0, response.getTask().getResponseAsMap().get("failure_count")); }); } /** * Test wait for completion. - * @param persist should the task persist its results + * @param storeResult should the task store its results * @param wait start waiting for a task. Accepts that id of the task to wait for and returns a future waiting for it. * @param validator validate the response and return the task ids that were found */ - private void waitForCompletionTestCase(boolean persist, Function> wait, Consumer validator) + private void waitForCompletionTestCase(boolean storeResult, Function> wait, Consumer validator) throws Exception { // Start blocking test task ListenableActionFuture future = TestTaskPlugin.TestTaskAction.INSTANCE.newRequestBuilder(client()) - .setShouldPersistResult(persist).execute(); + .setShouldStoreResult(storeResult).execute(); ListenableActionFuture waitResponseFuture; TaskId taskId; @@ -622,17 +622,17 @@ public class TasksIT extends ESIntegTestCase { assertThat(response.getTasks().size(), greaterThanOrEqualTo(1)); } - public void testTaskResultPersistence() throws Exception { + public void testTaskStoringSuccesfulResult() throws Exception { // Randomly create an empty index to make sure the type is created automatically if (randomBoolean()) { logger.info("creating an empty results index with custom settings"); - assertAcked(client().admin().indices().prepareCreate(TaskPersistenceService.TASK_INDEX)); + assertAcked(client().admin().indices().prepareCreate(TaskResultsService.TASK_INDEX)); } registerTaskManageListeners(TestTaskPlugin.TestTaskAction.NAME); // we need this to get task id of the process // Start non-blocking test task - TestTaskPlugin.TestTaskAction.INSTANCE.newRequestBuilder(client()).setShouldPersistResult(true).setShouldBlock(false).get(); + TestTaskPlugin.TestTaskAction.INSTANCE.newRequestBuilder(client()).setShouldStoreResult(true).setShouldBlock(false).get(); List events = findEvents(TestTaskPlugin.TestTaskAction.NAME, Tuple::v1); @@ -641,7 +641,7 @@ public class TasksIT extends ESIntegTestCase { TaskId taskId = taskInfo.getTaskId(); GetResponse resultDoc = client() - .prepareGet(TaskPersistenceService.TASK_INDEX, TaskPersistenceService.TASK_TYPE, taskId.toString()).get(); + .prepareGet(TaskResultsService.TASK_INDEX, TaskResultsService.TASK_TYPE, taskId.toString()).get(); assertTrue(resultDoc.isExists()); Map source = resultDoc.getSource(); @@ -657,16 +657,16 @@ public class TasksIT extends ESIntegTestCase { assertNull(source.get("failure")); - assertNoFailures(client().admin().indices().prepareRefresh(TaskPersistenceService.TASK_INDEX).get()); + assertNoFailures(client().admin().indices().prepareRefresh(TaskResultsService.TASK_INDEX).get()); - SearchResponse searchResponse = client().prepareSearch(TaskPersistenceService.TASK_INDEX) - .setTypes(TaskPersistenceService.TASK_TYPE) + SearchResponse searchResponse = client().prepareSearch(TaskResultsService.TASK_INDEX) + .setTypes(TaskResultsService.TASK_TYPE) .setSource(SearchSourceBuilder.searchSource().query(QueryBuilders.termQuery("task.action", taskInfo.getAction()))) .get(); assertEquals(1L, searchResponse.getHits().totalHits()); - searchResponse = client().prepareSearch(TaskPersistenceService.TASK_INDEX).setTypes(TaskPersistenceService.TASK_TYPE) + searchResponse = client().prepareSearch(TaskResultsService.TASK_INDEX).setTypes(TaskResultsService.TASK_TYPE) .setSource(SearchSourceBuilder.searchSource().query(QueryBuilders.termQuery("task.node", taskInfo.getTaskId().getNodeId()))) .get(); @@ -677,14 +677,14 @@ public class TasksIT extends ESIntegTestCase { assertNull(getResponse.getTask().getError()); } - public void testTaskFailurePersistence() throws Exception { + public void testTaskStoringFailureResult() throws Exception { registerTaskManageListeners(TestTaskPlugin.TestTaskAction.NAME); // we need this to get task id of the process // Start non-blocking test task that should fail assertThrows( TestTaskPlugin.TestTaskAction.INSTANCE.newRequestBuilder(client()) .setShouldFail(true) - .setShouldPersistResult(true) + .setShouldStoreResult(true) .setShouldBlock(false), IllegalStateException.class ); @@ -695,7 +695,7 @@ public class TasksIT extends ESIntegTestCase { TaskId failedTaskId = failedTaskInfo.getTaskId(); GetResponse failedResultDoc = client() - .prepareGet(TaskPersistenceService.TASK_INDEX, TaskPersistenceService.TASK_TYPE, failedTaskId.toString()) + .prepareGet(TaskResultsService.TASK_INDEX, TaskResultsService.TASK_TYPE, failedTaskId.toString()) .get(); assertTrue(failedResultDoc.isExists()); @@ -729,9 +729,9 @@ public class TasksIT extends ESIntegTestCase { public void testNodeNotFoundButTaskFound() throws Exception { // Save a fake task that looks like it is from a node that isn't part of the cluster CyclicBarrier b = new CyclicBarrier(2); - TaskPersistenceService resultsService = internalCluster().getInstance(TaskPersistenceService.class); - resultsService.persist( - new PersistedTaskInfo(new TaskInfo(new TaskId("fake", 1), "test", "test", "", null, 0, 0, false, TaskId.EMPTY_TASK_ID), + TaskResultsService resultsService = internalCluster().getInstance(TaskResultsService.class); + resultsService.storeResult( + new TaskResult(new TaskInfo(new TaskId("fake", 1), "test", "test", "", null, 0, 0, false, TaskId.EMPTY_TASK_ID), new RuntimeException("test")), new ActionListener() { @Override diff --git a/core/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TestTaskPlugin.java b/core/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TestTaskPlugin.java index 122ae910e7f..e91105291e3 100644 --- a/core/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TestTaskPlugin.java +++ b/core/src/test/java/org/elasticsearch/action/admin/cluster/node/tasks/TestTaskPlugin.java @@ -179,7 +179,7 @@ public class TestTaskPlugin extends Plugin implements ActionPlugin { public static class NodesRequest extends BaseNodesRequest { private String requestName; - private boolean shouldPersistResult = false; + private boolean shouldStoreResult = false; private boolean shouldBlock = true; private boolean shouldFail = false; @@ -192,13 +192,13 @@ public class TestTaskPlugin extends Plugin implements ActionPlugin { this.requestName = requestName; } - public void setShouldPersistResult(boolean shouldPersistResult) { - this.shouldPersistResult = shouldPersistResult; + public void setShouldStoreResult(boolean shouldStoreResult) { + this.shouldStoreResult = shouldStoreResult; } @Override - public boolean getShouldPersistResult() { - return shouldPersistResult; + public boolean getShouldStoreResult() { + return shouldStoreResult; } public void setShouldBlock(boolean shouldBlock) { @@ -221,7 +221,7 @@ public class TestTaskPlugin extends Plugin implements ActionPlugin { public void readFrom(StreamInput in) throws IOException { super.readFrom(in); requestName = in.readString(); - shouldPersistResult = in.readBoolean(); + shouldStoreResult = in.readBoolean(); shouldBlock = in.readBoolean(); shouldFail = in.readBoolean(); } @@ -230,7 +230,7 @@ public class TestTaskPlugin extends Plugin implements ActionPlugin { public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); out.writeString(requestName); - out.writeBoolean(shouldPersistResult); + out.writeBoolean(shouldStoreResult); out.writeBoolean(shouldBlock); out.writeBoolean(shouldFail); } @@ -336,8 +336,8 @@ public class TestTaskPlugin extends Plugin implements ActionPlugin { } - public NodesRequestBuilder setShouldPersistResult(boolean shouldPersistResult) { - request().setShouldPersistResult(shouldPersistResult); + public NodesRequestBuilder setShouldStoreResult(boolean shouldStoreResult) { + request().setShouldStoreResult(shouldStoreResult); return this; } diff --git a/core/src/test/java/org/elasticsearch/action/search/SearchScrollRequestTests.java b/core/src/test/java/org/elasticsearch/action/search/SearchScrollRequestTests.java new file mode 100644 index 00000000000..8e91b68d092 --- /dev/null +++ b/core/src/test/java/org/elasticsearch/action/search/SearchScrollRequestTests.java @@ -0,0 +1,121 @@ +/* + * 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. + */ + +package org.elasticsearch.action.search; + +import org.elasticsearch.common.io.stream.BytesStreamOutput; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.search.internal.InternalScrollSearchRequest; +import org.elasticsearch.test.ESTestCase; + +import java.io.IOException; + +public class SearchScrollRequestTests extends ESTestCase { + + public void testSerialization() throws Exception { + SearchScrollRequest searchScrollRequest = createSearchScrollRequest(); + try (BytesStreamOutput output = new BytesStreamOutput()) { + searchScrollRequest.writeTo(output); + try (StreamInput in = output.bytes().streamInput()) { + SearchScrollRequest deserializedRequest = new SearchScrollRequest(); + deserializedRequest.readFrom(in); + assertEquals(deserializedRequest, searchScrollRequest); + assertEquals(deserializedRequest.hashCode(), searchScrollRequest.hashCode()); + assertNotSame(deserializedRequest, searchScrollRequest); + } + } + } + + public void testInternalScrollSearchRequestSerialization() throws IOException { + SearchScrollRequest searchScrollRequest = createSearchScrollRequest(); + InternalScrollSearchRequest internalScrollSearchRequest = new InternalScrollSearchRequest(searchScrollRequest, randomLong()); + try (BytesStreamOutput output = new BytesStreamOutput()) { + internalScrollSearchRequest.writeTo(output); + try (StreamInput in = output.bytes().streamInput()) { + InternalScrollSearchRequest deserializedRequest = new InternalScrollSearchRequest(); + deserializedRequest.readFrom(in); + assertEquals(deserializedRequest.id(), internalScrollSearchRequest.id()); + assertEquals(deserializedRequest.scroll(), internalScrollSearchRequest.scroll()); + assertNotSame(deserializedRequest, internalScrollSearchRequest); + } + } + } + + public void testEqualsAndHashcode() { + SearchScrollRequest firstSearchScrollRequest = createSearchScrollRequest(); + assertNotNull("search scroll request is equal to null", firstSearchScrollRequest); + assertNotEquals("search scroll request is equal to incompatible type", firstSearchScrollRequest, ""); + assertEquals("search scroll request is not equal to self", firstSearchScrollRequest, firstSearchScrollRequest); + assertEquals("same source builder's hashcode returns different values if called multiple times", + firstSearchScrollRequest.hashCode(), firstSearchScrollRequest.hashCode()); + + SearchScrollRequest secondSearchScrollRequest = copyRequest(firstSearchScrollRequest); + assertEquals("search scroll request is not equal to self", secondSearchScrollRequest, secondSearchScrollRequest); + assertEquals("search scroll request is not equal to its copy", firstSearchScrollRequest, secondSearchScrollRequest); + assertEquals("search scroll request is not symmetric", secondSearchScrollRequest, firstSearchScrollRequest); + assertEquals("search scroll request copy's hashcode is different from original hashcode", + firstSearchScrollRequest.hashCode(), secondSearchScrollRequest.hashCode()); + + SearchScrollRequest thirdSearchScrollRequest = copyRequest(secondSearchScrollRequest); + assertEquals("search scroll request is not equal to self", thirdSearchScrollRequest, thirdSearchScrollRequest); + assertEquals("search scroll request is not equal to its copy", secondSearchScrollRequest, thirdSearchScrollRequest); + assertEquals("search scroll request copy's hashcode is different from original hashcode", + secondSearchScrollRequest.hashCode(), thirdSearchScrollRequest.hashCode()); + assertEquals("equals is not transitive", firstSearchScrollRequest, thirdSearchScrollRequest); + assertEquals("search scroll request copy's hashcode is different from original hashcode", + firstSearchScrollRequest.hashCode(), thirdSearchScrollRequest.hashCode()); + assertEquals("equals is not symmetric", thirdSearchScrollRequest, secondSearchScrollRequest); + assertEquals("equals is not symmetric", thirdSearchScrollRequest, firstSearchScrollRequest); + + boolean changed = false; + if (randomBoolean()) { + secondSearchScrollRequest.scrollId(randomAsciiOfLengthBetween(3, 10)); + if (secondSearchScrollRequest.scrollId().equals(firstSearchScrollRequest.scrollId()) == false) { + changed = true; + } + } + if (randomBoolean()) { + secondSearchScrollRequest.scroll(randomPositiveTimeValue()); + if (secondSearchScrollRequest.scroll().equals(firstSearchScrollRequest.scroll()) == false) { + changed = true; + } + } + + if (changed) { + assertNotEquals(firstSearchScrollRequest, secondSearchScrollRequest); + assertNotEquals(firstSearchScrollRequest.hashCode(), secondSearchScrollRequest.hashCode()); + } else { + assertEquals(firstSearchScrollRequest, secondSearchScrollRequest); + assertEquals(firstSearchScrollRequest.hashCode(), secondSearchScrollRequest.hashCode()); + } + } + + public static SearchScrollRequest createSearchScrollRequest() { + SearchScrollRequest searchScrollRequest = new SearchScrollRequest(randomAsciiOfLengthBetween(3, 10)); + searchScrollRequest.scroll(randomPositiveTimeValue()); + return searchScrollRequest; + } + + private static SearchScrollRequest copyRequest(SearchScrollRequest searchScrollRequest) { + SearchScrollRequest result = new SearchScrollRequest(); + result.scrollId(searchScrollRequest.scrollId()); + result.scroll(searchScrollRequest.scroll()); + return result; + } +} diff --git a/core/src/test/java/org/elasticsearch/action/termvectors/TermVectorsUnitTests.java b/core/src/test/java/org/elasticsearch/action/termvectors/TermVectorsUnitTests.java index 035f3b6599b..a1b0752617c 100644 --- a/core/src/test/java/org/elasticsearch/action/termvectors/TermVectorsUnitTests.java +++ b/core/src/test/java/org/elasticsearch/action/termvectors/TermVectorsUnitTests.java @@ -48,7 +48,7 @@ import org.elasticsearch.index.mapper.AllFieldMapper; import org.elasticsearch.index.mapper.FieldMapper; import org.elasticsearch.index.mapper.MapperParsingException; import org.elasticsearch.index.mapper.TypeParsers; -import org.elasticsearch.rest.action.termvectors.RestTermVectorsAction; +import org.elasticsearch.rest.action.document.RestTermVectorsAction; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.StreamsUtils; import org.hamcrest.Matchers; diff --git a/core/src/test/java/org/elasticsearch/indices/analysis/AnalysisModuleTests.java b/core/src/test/java/org/elasticsearch/indices/analysis/AnalysisModuleTests.java index e44d8a89cb7..33763571daf 100644 --- a/core/src/test/java/org/elasticsearch/indices/analysis/AnalysisModuleTests.java +++ b/core/src/test/java/org/elasticsearch/indices/analysis/AnalysisModuleTests.java @@ -132,7 +132,8 @@ public class AnalysisModuleTests extends ModuleTestCase { .put("index.analysis.analyzer.foobar_search.alias","default_search") .put("index.analysis.analyzer.foobar_search.type","english") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) - .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersion(random())) + // analyzer aliases are only allowed in 2.x indices + .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.V_2_3_5)) .build(); AnalysisRegistry newRegistry = getNewRegistry(settings); AnalysisService as = getAnalysisService(newRegistry, settings); @@ -147,7 +148,8 @@ public class AnalysisModuleTests extends ModuleTestCase { .put("index.analysis.analyzer.foobar_search.alias","default_search") .put("index.analysis.analyzer.foobar_search.type", "default") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) - .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersion(random())) + // analyzer aliases are only allowed in 2.x indices + .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.V_2_3_5)) .build(); AnalysisRegistry newRegistry = getNewRegistry(settings); AnalysisService as = getAnalysisService(newRegistry, settings); @@ -161,7 +163,8 @@ public class AnalysisModuleTests extends ModuleTestCase { .put("index.analysis.analyzer.foobar.alias","default") .put("index.analysis.analyzer.foobar.type", "keyword") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) - .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersion(random())) + // analyzer aliases are only allowed in 2.x indices + .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.V_2_3_5)) .build(); AnalysisRegistry newRegistry = getNewRegistry(settings); AnalysisService as = getAnalysisService(newRegistry, settings); @@ -175,13 +178,28 @@ public class AnalysisModuleTests extends ModuleTestCase { .put("index.analysis.analyzer.foobar.type", "keyword") .put("index.analysis.analyzer.foobar1.alias","default") .put("index.analysis.analyzer.foobar1.type", "english") - .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersion(random())) + // analyzer aliases are only allowed in 2.x indices + .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.V_2_3_5)) .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) .build(); AnalysisRegistry newRegistry = getNewRegistry(settings); IllegalStateException ise = expectThrows(IllegalStateException.class, () -> getAnalysisService(newRegistry, settings)); assertEquals("alias [default] is already used by [foobar]", ise.getMessage()); } + + public void testAnalyzerAliasNotAllowedPost5x() throws IOException { + Settings settings = Settings.builder() + .put("index.analysis.analyzer.foobar.type", "standard") + .put("index.analysis.analyzer.foobar.alias","foobaz") + // analyzer aliases were removed in v5.0.0 alpha6 + .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_5_0_0_alpha6, null)) + .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) + .build(); + AnalysisRegistry registry = getNewRegistry(settings); + IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> getAnalysisService(registry, settings)); + assertEquals("setting [index.analysis.analyzer.foobar.alias] is not supported", e.getMessage()); + } + public void testVersionedAnalyzers() throws Exception { String yaml = "/org/elasticsearch/index/analysis/test1.yml"; Settings settings2 = Settings.builder() @@ -246,10 +264,6 @@ public class AnalysisModuleTests extends ModuleTestCase { CustomAnalyzer custom5 = (CustomAnalyzer) analyzer; assertThat(custom5.charFilters()[0], instanceOf(MappingCharFilterFactory.class)); - // verify aliases - analyzer = analysisService.analyzer("alias1").analyzer(); - assertThat(analyzer, instanceOf(StandardAnalyzer.class)); - // check custom pattern replace filter analyzer = analysisService.analyzer("custom3").analyzer(); assertThat(analyzer, instanceOf(CustomAnalyzer.class)); @@ -332,7 +346,8 @@ public class AnalysisModuleTests extends ModuleTestCase { .put("index.analysis.analyzer.valid_name.tokenizer", "keyword") .put("index.analysis.analyzer.valid_name.alias", "_invalid_name") .put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString()) - .put(IndexMetaData.SETTING_VERSION_CREATED, "1") + // analyzer aliases are only allowed for 2.x indices + .put(IndexMetaData.SETTING_VERSION_CREATED, VersionUtils.randomVersionBetween(random(), Version.V_2_0_0, Version.V_2_3_5)) .build(); try { getAnalysisService(settings); diff --git a/core/src/test/java/org/elasticsearch/rest/action/main/RestMainActionTests.java b/core/src/test/java/org/elasticsearch/rest/action/RestMainActionTests.java similarity index 96% rename from core/src/test/java/org/elasticsearch/rest/action/main/RestMainActionTests.java rename to core/src/test/java/org/elasticsearch/rest/action/RestMainActionTests.java index ffefa074df7..0c8a1c9a3cc 100644 --- a/core/src/test/java/org/elasticsearch/rest/action/main/RestMainActionTests.java +++ b/core/src/test/java/org/elasticsearch/rest/action/RestMainActionTests.java @@ -17,7 +17,7 @@ * under the License. */ -package org.elasticsearch.rest.action.main; +package org.elasticsearch.rest.action; import org.elasticsearch.Build; import org.elasticsearch.Version; @@ -30,6 +30,8 @@ import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.RestStatus; +import org.elasticsearch.rest.RestRequest.Method; +import org.elasticsearch.rest.action.RestMainAction; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; diff --git a/core/src/test/java/org/elasticsearch/rest/action/support/RestTableTests.java b/core/src/test/java/org/elasticsearch/rest/action/cat/RestTableTests.java similarity index 96% rename from core/src/test/java/org/elasticsearch/rest/action/support/RestTableTests.java rename to core/src/test/java/org/elasticsearch/rest/action/cat/RestTableTests.java index 3dfae8cc4f8..f7dc6149052 100644 --- a/core/src/test/java/org/elasticsearch/rest/action/support/RestTableTests.java +++ b/core/src/test/java/org/elasticsearch/rest/action/cat/RestTableTests.java @@ -17,12 +17,13 @@ * under the License. */ -package org.elasticsearch.rest.action.support; +package org.elasticsearch.rest.action.cat; import org.elasticsearch.common.Table; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.rest.AbstractRestChannel; import org.elasticsearch.rest.RestResponse; +import org.elasticsearch.rest.action.cat.RestTable; import org.elasticsearch.test.ESTestCase; import org.elasticsearch.test.rest.FakeRestRequest; import org.junit.Before; @@ -32,8 +33,8 @@ import java.util.Collections; import java.util.List; import java.util.Map; -import static org.elasticsearch.rest.action.support.RestTable.buildDisplayHeaders; -import static org.elasticsearch.rest.action.support.RestTable.buildResponse; +import static org.elasticsearch.rest.action.cat.RestTable.buildDisplayHeaders; +import static org.elasticsearch.rest.action.cat.RestTable.buildResponse; import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItem; diff --git a/core/src/test/java/org/elasticsearch/search/SearchRequestTests.java b/core/src/test/java/org/elasticsearch/search/SearchRequestTests.java new file mode 100644 index 00000000000..3db3492f415 --- /dev/null +++ b/core/src/test/java/org/elasticsearch/search/SearchRequestTests.java @@ -0,0 +1,256 @@ +/* + * 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. + */ + +package org.elasticsearch.search; + +import org.elasticsearch.action.search.SearchRequest; +import org.elasticsearch.action.search.SearchType; +import org.elasticsearch.action.support.IndicesOptions; +import org.elasticsearch.common.io.stream.BytesStreamOutput; +import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; +import org.elasticsearch.common.io.stream.NamedWriteableRegistry; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.unit.TimeValue; +import org.elasticsearch.indices.IndicesModule; +import org.elasticsearch.test.ESTestCase; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import static java.util.Collections.emptyList; +import static org.elasticsearch.search.builder.SearchSourceBuilderTests.createSearchSourceBuilder; + +public class SearchRequestTests extends ESTestCase { + + private static NamedWriteableRegistry namedWriteableRegistry; + + @BeforeClass + public static void beforeClass() { + IndicesModule indicesModule = new IndicesModule(emptyList()) { + @Override + protected void configure() { + bindMapperExtension(); + } + }; + SearchModule searchModule = new SearchModule(Settings.EMPTY, false, emptyList()) { + @Override + protected void configureSearch() { + // Skip me + } + }; + List entries = new ArrayList<>(); + entries.addAll(indicesModule.getNamedWriteables()); + entries.addAll(searchModule.getNamedWriteables()); + namedWriteableRegistry = new NamedWriteableRegistry(entries); + } + + @AfterClass + public static void afterClass() { + namedWriteableRegistry = null; + } + + public void testSerialization() throws Exception { + SearchRequest searchRequest = createSearchRequest(); + try (BytesStreamOutput output = new BytesStreamOutput()) { + searchRequest.writeTo(output); + try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), namedWriteableRegistry)) { + SearchRequest deserializedRequest = new SearchRequest(); + deserializedRequest.readFrom(in); + assertEquals(deserializedRequest, searchRequest); + assertEquals(deserializedRequest.hashCode(), searchRequest.hashCode()); + assertNotSame(deserializedRequest, searchRequest); + } + } + } + + public void testIllegalArguments() { + SearchRequest searchRequest = new SearchRequest(); + assertNotNull(searchRequest.indices()); + assertNotNull(searchRequest.indicesOptions()); + assertNotNull(searchRequest.types()); + assertNotNull(searchRequest.searchType()); + + NullPointerException e = expectThrows(NullPointerException.class, () -> searchRequest.indices((String[]) null)); + assertEquals("indices must not be null", e.getMessage()); + e = expectThrows(NullPointerException.class, () -> searchRequest.indices((String) null)); + assertEquals("index must not be null", e.getMessage()); + + e = expectThrows(NullPointerException.class, () -> searchRequest.indicesOptions(null)); + assertEquals("indicesOptions must not be null", e.getMessage()); + + e = expectThrows(NullPointerException.class, () -> searchRequest.types((String[]) null)); + assertEquals("types must not be null", e.getMessage()); + e = expectThrows(NullPointerException.class, () -> searchRequest.types((String) null)); + assertEquals("type must not be null", e.getMessage()); + + e = expectThrows(NullPointerException.class, () -> searchRequest.searchType((SearchType)null)); + assertEquals("searchType must not be null", e.getMessage()); + + e = expectThrows(NullPointerException.class, () -> searchRequest.source(null)); + assertEquals("source must not be null", e.getMessage()); + + e = expectThrows(NullPointerException.class, () -> searchRequest.scroll((TimeValue)null)); + assertEquals("keepAlive must not be null", e.getMessage()); + } + + public void testEqualsAndHashcode() throws IOException { + SearchRequest firstSearchRequest = createSearchRequest(); + assertNotNull("search request is equal to null", firstSearchRequest); + assertNotEquals("search request is equal to incompatible type", firstSearchRequest, ""); + assertEquals("search request is not equal to self", firstSearchRequest, firstSearchRequest); + assertEquals("same source builder's hashcode returns different values if called multiple times", + firstSearchRequest.hashCode(), firstSearchRequest.hashCode()); + + SearchRequest secondSearchRequest = copyRequest(firstSearchRequest); + assertEquals("search request is not equal to self", secondSearchRequest, secondSearchRequest); + assertEquals("search request is not equal to its copy", firstSearchRequest, secondSearchRequest); + assertEquals("search request is not symmetric", secondSearchRequest, firstSearchRequest); + assertEquals("search request copy's hashcode is different from original hashcode", + firstSearchRequest.hashCode(), secondSearchRequest.hashCode()); + + SearchRequest thirdSearchRequest = copyRequest(secondSearchRequest); + assertEquals("search request is not equal to self", thirdSearchRequest, thirdSearchRequest); + assertEquals("search request is not equal to its copy", secondSearchRequest, thirdSearchRequest); + assertEquals("search request copy's hashcode is different from original hashcode", + secondSearchRequest.hashCode(), thirdSearchRequest.hashCode()); + assertEquals("equals is not transitive", firstSearchRequest, thirdSearchRequest); + assertEquals("search request copy's hashcode is different from original hashcode", + firstSearchRequest.hashCode(), thirdSearchRequest.hashCode()); + assertEquals("equals is not symmetric", thirdSearchRequest, secondSearchRequest); + assertEquals("equals is not symmetric", thirdSearchRequest, firstSearchRequest); + + boolean changed = false; + if (randomBoolean()) { + secondSearchRequest.indices(generateRandomStringArray(10, 10, false, false)); + if (Arrays.equals(secondSearchRequest.indices(), firstSearchRequest.indices()) == false) { + changed = true; + } + } + if (randomBoolean()) { + secondSearchRequest.indicesOptions( + IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean())); + if (secondSearchRequest.indicesOptions().equals(firstSearchRequest.indicesOptions()) == false) { + changed = true; + } + } + if (randomBoolean()) { + secondSearchRequest.types(generateRandomStringArray(10, 10, false, false)); + if (Arrays.equals(secondSearchRequest.types(), firstSearchRequest.types()) == false) { + changed = true; + } + } + if (randomBoolean()) { + secondSearchRequest.preference(randomAsciiOfLengthBetween(3, 10)); + if (secondSearchRequest.preference().equals(firstSearchRequest.preference()) == false) { + changed = true; + } + } + if (randomBoolean()) { + secondSearchRequest.routing(randomAsciiOfLengthBetween(3, 10)); + if (secondSearchRequest.routing().equals(firstSearchRequest.routing()) == false) { + changed = true; + } + } + if (randomBoolean()) { + secondSearchRequest.requestCache(randomBoolean()); + if (secondSearchRequest.requestCache().equals(firstSearchRequest.requestCache()) == false) { + changed = true; + } + } + if (randomBoolean()) { + secondSearchRequest.scroll(randomPositiveTimeValue()); + if (secondSearchRequest.scroll().equals(firstSearchRequest.scroll()) == false) { + changed = true; + } + } + if (randomBoolean()) { + secondSearchRequest.searchType(randomFrom(SearchType.values())); + if (secondSearchRequest.searchType() != firstSearchRequest.searchType()) { + changed = true; + } + } + if (randomBoolean()) { + secondSearchRequest.source(createSearchSourceBuilder()); + if (secondSearchRequest.source().equals(firstSearchRequest.source()) == false) { + changed = true; + } + } + + if (changed) { + assertNotEquals(firstSearchRequest, secondSearchRequest); + assertNotEquals(firstSearchRequest.hashCode(), secondSearchRequest.hashCode()); + } else { + assertEquals(firstSearchRequest, secondSearchRequest); + assertEquals(firstSearchRequest.hashCode(), secondSearchRequest.hashCode()); + } + } + + public static SearchRequest createSearchRequest() throws IOException { + SearchRequest searchRequest = new SearchRequest(); + if (randomBoolean()) { + searchRequest.indices(generateRandomStringArray(10, 10, false, false)); + } + if (randomBoolean()) { + searchRequest.indicesOptions(IndicesOptions.fromOptions(randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean())); + } + if (randomBoolean()) { + searchRequest.types(generateRandomStringArray(10, 10, false, false)); + } + if (randomBoolean()) { + searchRequest.preference(randomAsciiOfLengthBetween(3, 10)); + } + if (randomBoolean()) { + searchRequest.requestCache(randomBoolean()); + } + if (randomBoolean()) { + searchRequest.routing(randomAsciiOfLengthBetween(3, 10)); + } + if (randomBoolean()) { + searchRequest.scroll(randomPositiveTimeValue()); + } + if (randomBoolean()) { + searchRequest.searchType(randomFrom(SearchType.values())); + } + if (randomBoolean()) { + searchRequest.source(createSearchSourceBuilder()); + } + return searchRequest; + } + + private static SearchRequest copyRequest(SearchRequest searchRequest) throws IOException { + SearchRequest result = new SearchRequest(); + result.indices(searchRequest.indices()); + result.indicesOptions(searchRequest.indicesOptions()); + result.types(searchRequest.types()); + result.searchType(searchRequest.searchType()); + result.preference(searchRequest.preference()); + result.routing(searchRequest.routing()); + result.requestCache(searchRequest.requestCache()); + result.scroll(searchRequest.scroll()); + if (searchRequest.source() != null) { + result.source(searchRequest.source()); + } + return result; + } +} diff --git a/core/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java b/core/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java index 4101190df83..08a2d7f515f 100644 --- a/core/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java +++ b/core/src/test/java/org/elasticsearch/search/builder/SearchSourceBuilderTests.java @@ -190,7 +190,7 @@ public class SearchSourceBuilderTests extends ESTestCase { namedWriteableRegistry = null; } - protected final SearchSourceBuilder createSearchSourceBuilder() throws IOException { + public static SearchSourceBuilder createSearchSourceBuilder() throws IOException { SearchSourceBuilder builder = new SearchSourceBuilder(); if (randomBoolean()) { builder.from(randomIntBetween(0, 10000)); @@ -484,8 +484,8 @@ public class SearchSourceBuilderTests extends ESTestCase { assertTrue("equals is not symmetric", thirdBuilder.equals(firstBuilder)); } - //we use the streaming infra to create a copy of the query provided as argument - protected SearchSourceBuilder copyBuilder(SearchSourceBuilder builder) throws IOException { + //we use the streaming infra to create a copy of the builder provided as argument + protected static SearchSourceBuilder copyBuilder(SearchSourceBuilder builder) throws IOException { try (BytesStreamOutput output = new BytesStreamOutput()) { builder.writeTo(output); try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), namedWriteableRegistry)) { diff --git a/core/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlighterSearchIT.java b/core/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlighterSearchIT.java index c7a5fc241ab..33e8cb3784f 100644 --- a/core/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlighterSearchIT.java +++ b/core/src/test/java/org/elasticsearch/search/fetch/subphase/highlight/HighlighterSearchIT.java @@ -1400,7 +1400,6 @@ public class HighlighterSearchIT extends ESIntegTestCase { assertHighlight(searchResponse, 0, "field2", 0, 1, equalTo("The quick brown fox jumps over the lazy dog")); } - @AwaitsFix(bugUrl="Broken now that BoostingQuery does not extend BooleanQuery anymore") public void testBoostingQueryTermVector() throws IOException { assertAcked(prepareCreate("test").addMapping("type1", type1TermVectorMapping())); ensureGreen(); @@ -2643,7 +2642,6 @@ public class HighlighterSearchIT extends ESIntegTestCase { } } - @AwaitsFix(bugUrl="Broken now that BoostingQuery does not extend BooleanQuery anymore") public void testFastVectorHighlighterPhraseBoost() throws Exception { assertAcked(prepareCreate("test").addMapping("type1", type1TermVectorMapping())); phraseBoostTestCase("fvh"); diff --git a/core/src/test/java/org/elasticsearch/search/internal/ShardSearchTransportRequestTests.java b/core/src/test/java/org/elasticsearch/search/internal/ShardSearchTransportRequestTests.java new file mode 100644 index 00000000000..a49fdef5596 --- /dev/null +++ b/core/src/test/java/org/elasticsearch/search/internal/ShardSearchTransportRequestTests.java @@ -0,0 +1,118 @@ +/* + * 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. + */ + +package org.elasticsearch.search.internal; + +import org.elasticsearch.action.search.SearchRequest; +import org.elasticsearch.cluster.routing.RestoreSource; +import org.elasticsearch.cluster.routing.ShardRouting; +import org.elasticsearch.cluster.routing.UnassignedInfo; +import org.elasticsearch.common.Strings; +import org.elasticsearch.common.io.stream.BytesStreamOutput; +import org.elasticsearch.common.io.stream.NamedWriteableAwareStreamInput; +import org.elasticsearch.common.io.stream.NamedWriteableRegistry; +import org.elasticsearch.common.io.stream.StreamInput; +import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.index.shard.ShardId; +import org.elasticsearch.indices.IndicesModule; +import org.elasticsearch.search.SearchModule; +import org.elasticsearch.search.SearchRequestTests; +import org.elasticsearch.snapshots.Snapshot; +import org.elasticsearch.snapshots.SnapshotId; +import org.elasticsearch.test.ESTestCase; +import org.elasticsearch.test.VersionUtils; +import org.junit.AfterClass; +import org.junit.BeforeClass; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import static java.util.Collections.emptyList; + +public class ShardSearchTransportRequestTests extends ESTestCase { + + private static NamedWriteableRegistry namedWriteableRegistry; + + @BeforeClass + public static void beforeClass() { + IndicesModule indicesModule = new IndicesModule(emptyList()) { + @Override + protected void configure() { + bindMapperExtension(); + } + }; + SearchModule searchModule = new SearchModule(Settings.EMPTY, false, emptyList()) { + @Override + protected void configureSearch() { + // Skip me + } + }; + List entries = new ArrayList<>(); + entries.addAll(indicesModule.getNamedWriteables()); + entries.addAll(searchModule.getNamedWriteables()); + namedWriteableRegistry = new NamedWriteableRegistry(entries); + } + + @AfterClass + public static void afterClass() { + namedWriteableRegistry = null; + } + + public void testSerialization() throws Exception { + ShardSearchTransportRequest shardSearchTransportRequest = createShardSearchTransportRequest(); + try (BytesStreamOutput output = new BytesStreamOutput()) { + shardSearchTransportRequest.writeTo(output); + try (StreamInput in = new NamedWriteableAwareStreamInput(output.bytes().streamInput(), namedWriteableRegistry)) { + ShardSearchTransportRequest deserializedRequest = new ShardSearchTransportRequest(); + deserializedRequest.readFrom(in); + assertEquals(deserializedRequest.scroll(), shardSearchTransportRequest.scroll()); + assertArrayEquals(deserializedRequest.filteringAliases(), shardSearchTransportRequest.filteringAliases()); + assertArrayEquals(deserializedRequest.indices(), shardSearchTransportRequest.indices()); + assertArrayEquals(deserializedRequest.types(), shardSearchTransportRequest.types()); + assertEquals(deserializedRequest.indicesOptions(), shardSearchTransportRequest.indicesOptions()); + assertEquals(deserializedRequest.isProfile(), shardSearchTransportRequest.isProfile()); + assertEquals(deserializedRequest.nowInMillis(), shardSearchTransportRequest.nowInMillis()); + assertEquals(deserializedRequest.source(), shardSearchTransportRequest.source()); + assertEquals(deserializedRequest.searchType(), shardSearchTransportRequest.searchType()); + assertEquals(deserializedRequest.shardId(), shardSearchTransportRequest.shardId()); + assertEquals(deserializedRequest.numberOfShards(), shardSearchTransportRequest.numberOfShards()); + assertNotSame(deserializedRequest, shardSearchTransportRequest); + } + } + } + + private static ShardSearchTransportRequest createShardSearchTransportRequest() throws IOException { + SearchRequest searchRequest = SearchRequestTests.createSearchRequest(); + ShardId shardId = new ShardId(randomAsciiOfLengthBetween(2, 10), randomAsciiOfLengthBetween(2, 10), randomInt()); + Snapshot snapshot = new Snapshot(randomAsciiOfLengthBetween(3, 10), + new SnapshotId(randomAsciiOfLengthBetween(3, 10), randomAsciiOfLengthBetween(3, 10))); + RestoreSource restoreSource = new RestoreSource(snapshot, VersionUtils.randomVersion(random()), randomAsciiOfLengthBetween(3, 10)); + ShardRouting shardRouting = ShardRouting.newUnassigned(shardId, restoreSource, randomBoolean(), + new UnassignedInfo(randomFrom(UnassignedInfo.Reason.values()), "reason")); + String[] filteringAliases; + if (randomBoolean()) { + filteringAliases = generateRandomStringArray(10, 10, false, false); + } else { + filteringAliases = Strings.EMPTY_ARRAY; + } + return new ShardSearchTransportRequest(searchRequest, shardRouting, + randomIntBetween(1, 100), filteringAliases, Math.abs(randomLong())); + } +} diff --git a/core/src/test/java/org/elasticsearch/search/simple/SimpleSearchIT.java b/core/src/test/java/org/elasticsearch/search/simple/SimpleSearchIT.java index e94fe21a170..95978991046 100644 --- a/core/src/test/java/org/elasticsearch/search/simple/SimpleSearchIT.java +++ b/core/src/test/java/org/elasticsearch/search/simple/SimpleSearchIT.java @@ -19,10 +19,6 @@ package org.elasticsearch.search.simple; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ExecutionException; - import org.apache.lucene.util.Constants; import org.elasticsearch.action.index.IndexRequestBuilder; import org.elasticsearch.action.search.SearchPhaseExecutionException; @@ -36,6 +32,11 @@ import org.elasticsearch.rest.RestStatus; import org.elasticsearch.search.rescore.QueryRescorerBuilder; import org.elasticsearch.test.ESIntegTestCase; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ExecutionException; + +import static com.carrotsearch.randomizedtesting.RandomizedTest.systemPropertyAsBoolean; import static org.elasticsearch.action.support.WriteRequest.RefreshPolicy.IMMEDIATE; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS; import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS; @@ -50,23 +51,14 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitC import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures; import static org.hamcrest.Matchers.containsString; -import static com.carrotsearch.randomizedtesting.RandomizedTest.systemPropertyAsBoolean; - public class SimpleSearchIT extends ESIntegTestCase { public void testSearchNullIndex() { - try { - client().prepareSearch((String) null).setQuery(QueryBuilders.termQuery("_id", "XXX1")).execute().actionGet(); - fail(); - } catch (IllegalArgumentException e) { + expectThrows(NullPointerException.class, + () -> client().prepareSearch((String) null).setQuery(QueryBuilders.termQuery("_id", "XXX1")).get()); - } + expectThrows(NullPointerException.class, + () -> client().prepareSearch((String[]) null).setQuery(QueryBuilders.termQuery("_id", "XXX1")).get()); - try { - client().prepareSearch((String[]) null).setQuery(QueryBuilders.termQuery("_id", "XXX1")).execute().actionGet(); - fail(); - } catch (IllegalArgumentException e) { - - } } public void testSearchRandomPreference() throws InterruptedException, ExecutionException { diff --git a/core/src/test/java/org/elasticsearch/tasks/PersistedTaskInfoTests.java b/core/src/test/java/org/elasticsearch/tasks/TaskResultTests.java similarity index 86% rename from core/src/test/java/org/elasticsearch/tasks/PersistedTaskInfoTests.java rename to core/src/test/java/org/elasticsearch/tasks/TaskResultTests.java index 055abb8c686..abf7bbf108c 100644 --- a/core/src/test/java/org/elasticsearch/tasks/PersistedTaskInfoTests.java +++ b/core/src/test/java/org/elasticsearch/tasks/TaskResultTests.java @@ -38,18 +38,18 @@ import java.util.Map; import java.util.TreeMap; /** - * Round trip tests for {@link PersistedTaskInfo} and those classes that it includes like {@link TaskInfo} and {@link RawTaskStatus}. + * Round trip tests for {@link TaskResult} and those classes that it includes like {@link TaskInfo} and {@link RawTaskStatus}. */ -public class PersistedTaskInfoTests extends ESTestCase { +public class TaskResultTests extends ESTestCase { public void testBinaryRoundTrip() throws IOException { NamedWriteableRegistry registry = new NamedWriteableRegistry(Collections.singletonList( new NamedWriteableRegistry.Entry(Task.Status.class, RawTaskStatus.NAME, RawTaskStatus::new))); - PersistedTaskInfo result = randomTaskResult(); - PersistedTaskInfo read; + TaskResult result = randomTaskResult(); + TaskResult read; try (BytesStreamOutput out = new BytesStreamOutput()) { result.writeTo(out); try (StreamInput in = new NamedWriteableAwareStreamInput(out.bytes().streamInput(), registry)) { - read = new PersistedTaskInfo(in); + read = new TaskResult(in); } } catch (IOException e) { throw new IOException("Error processing [" + result + "]", e); @@ -62,13 +62,13 @@ public class PersistedTaskInfoTests extends ESTestCase { * Note that this round trip isn't 100% perfect - status will always be read as RawTaskStatus. Since this test uses RawTaskStatus * as the status we randomly generate then we can assert the round trip with .equals. */ - PersistedTaskInfo result = randomTaskResult(); - PersistedTaskInfo read; + TaskResult result = randomTaskResult(); + TaskResult read; try (XContentBuilder builder = XContentBuilder.builder(randomFrom(XContentType.values()).xContent())) { result.toXContent(builder, ToXContent.EMPTY_PARAMS); try (XContentBuilder shuffled = shuffleXContent(builder); XContentParser parser = XContentHelper.createParser(shuffled.bytes())) { - read = PersistedTaskInfo.PARSER.apply(parser, () -> ParseFieldMatcher.STRICT); + read = TaskResult.PARSER.apply(parser, () -> ParseFieldMatcher.STRICT); } } catch (IOException e) { throw new IOException("Error processing [" + result + "]", e); @@ -76,14 +76,14 @@ public class PersistedTaskInfoTests extends ESTestCase { assertEquals(result, read); } - private static PersistedTaskInfo randomTaskResult() throws IOException { + private static TaskResult randomTaskResult() throws IOException { switch (between(0, 2)) { case 0: - return new PersistedTaskInfo(randomBoolean(), randomTaskInfo()); + return new TaskResult(randomBoolean(), randomTaskInfo()); case 1: - return new PersistedTaskInfo(randomTaskInfo(), new RuntimeException("error")); + return new TaskResult(randomTaskInfo(), new RuntimeException("error")); case 2: - return new PersistedTaskInfo(randomTaskInfo(), randomTaskResponse()); + return new TaskResult(randomTaskInfo(), randomTaskResponse()); default: throw new UnsupportedOperationException("Unsupported random TaskResult constructor"); } diff --git a/core/src/test/resources/org/elasticsearch/index/analysis/test1.json b/core/src/test/resources/org/elasticsearch/index/analysis/test1.json index 24349635671..2244ea4361c 100644 --- a/core/src/test/resources/org/elasticsearch/index/analysis/test1.json +++ b/core/src/test/resources/org/elasticsearch/index/analysis/test1.json @@ -41,12 +41,10 @@ }, "analyzer":{ "standard":{ - "alias":"alias1,alias2", "type":"standard", "stopwords":["test1", "test2", "test3"] }, "custom1":{ - "alias":["alias4", "alias5"], "tokenizer":"standard", "filter":["stop", "stop2"] }, diff --git a/core/src/test/resources/org/elasticsearch/index/analysis/test1.yml b/core/src/test/resources/org/elasticsearch/index/analysis/test1.yml index 196e4ef871a..afcdb9a88ef 100644 --- a/core/src/test/resources/org/elasticsearch/index/analysis/test1.yml +++ b/core/src/test/resources/org/elasticsearch/index/analysis/test1.yml @@ -29,11 +29,9 @@ index : word_list : [donau, dampf, schiff, spargel, creme, suppe] analyzer : standard : - alias: alias1,alias2 type : standard stopwords : [test1, test2, test3] custom1 : - alias : [alias4, alias5] tokenizer : standard filter : [stop, stop2] custom2 : diff --git a/docs/reference/migration/migrate_5_0/scripting.asciidoc b/docs/reference/migration/migrate_5_0/scripting.asciidoc index 0f50e6232c3..52a26c89d1b 100644 --- a/docs/reference/migration/migrate_5_0/scripting.asciidoc +++ b/docs/reference/migration/migrate_5_0/scripting.asciidoc @@ -314,4 +314,28 @@ instead the constructors on `TemplateQueryBuilder` should be used. ==== Template query The `template` query has been deprecated in favour of the search template api. The `template` query is scheduled -to be removed in the next major version. \ No newline at end of file +to be removed in the next major version. + +==== GeoPoint scripts + +The following helper methods have been removed from GeoPoint scripting: + +* `factorDistance` +* `factorDistanceWithDefault` +* `factorDistance02` +* `factorDistance13` +* `arcDistanceInKm` +* `arcDistanceInKmWithDefault` +* `arcDistanceInMiles` +* `arcDistanceInMilesWithDefault` +* `distanceWithDefault` +* `distanceInKm` +* `distanceInKmWithDefault` +* `distanceInMiles` +* `distanceInMilesWithDefault` +* `geohashDistanceInKm` +* `geohashDistanceInMiles` + +Instead use `arcDistance`, `arcDistanceWithDefault`, `planeDistance`, `planeDistanceWithDefault`, `geohashDistance`, +`geohashDistanceWithDefault` and convert from default units (meters) to desired units using the appropriate constance +(e.g., multiply by `0.001` to convert to Km). \ No newline at end of file diff --git a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ScriptProcessor.java b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ScriptProcessor.java index 4799d6a50fe..bb8606feaeb 100644 --- a/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ScriptProcessor.java +++ b/modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/ScriptProcessor.java @@ -51,13 +51,11 @@ public final class ScriptProcessor extends AbstractProcessor { private final Script script; private final ScriptService scriptService; - private final String field; - ScriptProcessor(String tag, Script script, ScriptService scriptService, String field) { + ScriptProcessor(String tag, Script script, ScriptService scriptService) { super(tag); this.script = script; this.scriptService = scriptService; - this.field = field; } @Override @@ -66,10 +64,7 @@ public final class ScriptProcessor extends AbstractProcessor { vars.put("ctx", document.getSourceAndMetadata()); CompiledScript compiledScript = scriptService.compile(script, ScriptContext.Standard.INGEST, emptyMap()); ExecutableScript executableScript = scriptService.executable(compiledScript, vars); - Object value = executableScript.run(); - if (field != null) { - document.setFieldValue(field, value); - } + executableScript.run(); } @Override @@ -88,7 +83,6 @@ public final class ScriptProcessor extends AbstractProcessor { @Override public ScriptProcessor create(Map registry, String processorTag, Map config) throws Exception { - String field = readOptionalStringProperty(TYPE, processorTag, config, "field"); String lang = readStringProperty(TYPE, processorTag, config, "lang"); String inline = readOptionalStringProperty(TYPE, processorTag, config, "inline"); String file = readOptionalStringProperty(TYPE, processorTag, config, "file"); @@ -116,7 +110,7 @@ public final class ScriptProcessor extends AbstractProcessor { throw newConfigurationException(TYPE, processorTag, null, "Could not initialize script"); } - return new ScriptProcessor(processorTag, script, scriptService, field); + return new ScriptProcessor(processorTag, script, scriptService); } } } diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorFactoryTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorFactoryTests.java index 806aacd9e23..ef517d986cb 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorFactoryTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorFactoryTests.java @@ -52,7 +52,6 @@ public class ScriptProcessorFactoryTests extends ESTestCase { configMap.put(randomType, "foo"); configMap.put(otherRandomType, "bar"); - configMap.put("field", "my_field"); configMap.put("lang", "mockscript"); ElasticsearchException exception = expectThrows(ElasticsearchException.class, @@ -62,7 +61,6 @@ public class ScriptProcessorFactoryTests extends ESTestCase { public void testFactoryValidationAtLeastOneScriptingType() throws Exception { Map configMap = new HashMap<>(); - configMap.put("field", "my_field"); configMap.put("lang", "mockscript"); ElasticsearchException exception = expectThrows(ElasticsearchException.class, diff --git a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorTests.java b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorTests.java index 24ca1cf39a3..b8e2f07a31f 100644 --- a/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorTests.java +++ b/modules/ingest-common/src/test/java/org/elasticsearch/ingest/common/ScriptProcessorTests.java @@ -29,37 +29,46 @@ import org.elasticsearch.script.ExecutableScript; import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptService; import org.elasticsearch.test.ESTestCase; +import org.mockito.stubbing.Answer; import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.core.Is.is; import static org.mockito.Mockito.any; +import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; public class ScriptProcessorTests extends ESTestCase { public void testScripting() throws Exception { - int randomInt = randomInt(); + int randomBytesIn = randomInt(); + int randomBytesOut = randomInt(); + int randomBytesTotal = randomBytesIn + randomBytesOut; + ScriptService scriptService = mock(ScriptService.class); CompiledScript compiledScript = mock(CompiledScript.class); Script script = new Script("_script"); when(scriptService.compile(any(), any(), any())).thenReturn(compiledScript); ExecutableScript executableScript = mock(ExecutableScript.class); when(scriptService.executable(any(), any())).thenReturn(executableScript); - when(executableScript.run()).thenReturn(randomInt); - - ScriptProcessor processor = new ScriptProcessor(randomAsciiOfLength(10), script, - scriptService, "bytes_total"); Map document = new HashMap<>(); - document.put("bytes_in", 1234); - document.put("bytes_out", 4321); + document.put("bytes_in", randomInt()); + document.put("bytes_out", randomInt()); IngestDocument ingestDocument = RandomDocumentPicks.randomIngestDocument(random(), document); + + doAnswer(invocationOnMock -> { + ingestDocument.setFieldValue("bytes_total", randomBytesTotal); + return null; + }).when(executableScript).run(); + + ScriptProcessor processor = new ScriptProcessor(randomAsciiOfLength(10), script, scriptService); + processor.execute(ingestDocument); assertThat(ingestDocument.getSourceAndMetadata(), hasKey("bytes_in")); assertThat(ingestDocument.getSourceAndMetadata(), hasKey("bytes_out")); assertThat(ingestDocument.getSourceAndMetadata(), hasKey("bytes_total")); - assertThat(ingestDocument.getSourceAndMetadata().get("bytes_total"), is(randomInt)); + assertThat(ingestDocument.getSourceAndMetadata().get("bytes_total"), is(randomBytesTotal)); } } diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java index c0ed4b59ef6..a7b8615372f 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestMultiSearchTemplateAction.java @@ -28,9 +28,9 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.rest.action.search.RestMultiSearchAction; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestToXContentListener; import java.io.IOException; diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java index 33c8a17c742..74dc6363f3b 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestRenderSearchTemplateAction.java @@ -26,8 +26,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestToXContentListener; import org.elasticsearch.script.ScriptService; import static org.elasticsearch.rest.RestRequest.Method.GET; diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java index 42cd3987d47..cbac185deeb 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/RestSearchTemplateAction.java @@ -39,9 +39,9 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestStatusToXContentListener; import org.elasticsearch.rest.action.search.RestSearchAction; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestStatusToXContentListener; import org.elasticsearch.script.ScriptService; import org.elasticsearch.search.aggregations.AggregatorParsers; import org.elasticsearch.search.suggest.Suggesters; diff --git a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateResponse.java b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateResponse.java index 22d18b5f3d8..97003dd2737 100644 --- a/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateResponse.java +++ b/modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateResponse.java @@ -28,7 +28,7 @@ import org.elasticsearch.common.text.Text; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; -import org.elasticsearch.rest.action.support.RestActions; +import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.fetch.subphase.highlight.HighlightField; diff --git a/modules/percolator/src/main/java/org/elasticsearch/percolator/RestMultiPercolateAction.java b/modules/percolator/src/main/java/org/elasticsearch/percolator/RestMultiPercolateAction.java index 3045fa08a09..3d8631624ea 100644 --- a/modules/percolator/src/main/java/org/elasticsearch/percolator/RestMultiPercolateAction.java +++ b/modules/percolator/src/main/java/org/elasticsearch/percolator/RestMultiPercolateAction.java @@ -27,8 +27,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestToXContentListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; diff --git a/modules/percolator/src/main/java/org/elasticsearch/percolator/RestPercolateAction.java b/modules/percolator/src/main/java/org/elasticsearch/percolator/RestPercolateAction.java index 1f8c99b2e97..35d9f2c604a 100644 --- a/modules/percolator/src/main/java/org/elasticsearch/percolator/RestPercolateAction.java +++ b/modules/percolator/src/main/java/org/elasticsearch/percolator/RestPercolateAction.java @@ -29,8 +29,8 @@ import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestChannel; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; -import org.elasticsearch.rest.action.support.RestActions; -import org.elasticsearch.rest.action.support.RestToXContentListener; +import org.elasticsearch.rest.action.RestActions; +import org.elasticsearch.rest.action.RestToXContentListener; import static org.elasticsearch.rest.RestRequest.Method.GET; import static org.elasticsearch.rest.RestRequest.Method.POST; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBaseReindexRestHandler.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBaseReindexRestHandler.java index 266116570e6..ef14f6fa66b 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBaseReindexRestHandler.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBaseReindexRestHandler.java @@ -77,7 +77,7 @@ public abstract class AbstractBaseReindexRestHandler< client.executeLocally(action, internal, new BulkIndexByScrollResponseContentListener(channel, params)); return; } else { - internal.setShouldPersistResult(true); + internal.setShouldStoreResult(true); } /* diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByQueryRestHandler.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByQueryRestHandler.java index 41f103698d6..d81b5e054f4 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByQueryRestHandler.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByQueryRestHandler.java @@ -31,8 +31,8 @@ import org.elasticsearch.common.xcontent.XContentHelper; import org.elasticsearch.common.xcontent.XContentType; import org.elasticsearch.indices.query.IndicesQueriesRegistry; import org.elasticsearch.rest.RestRequest; +import org.elasticsearch.rest.action.RestActions; import org.elasticsearch.rest.action.search.RestSearchAction; -import org.elasticsearch.rest.action.support.RestActions; import org.elasticsearch.search.aggregations.AggregatorParsers; import org.elasticsearch.search.suggest.Suggesters; diff --git a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java index e34029bffab..1329aeb6d8c 100644 --- a/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java +++ b/modules/reindex/src/main/java/org/elasticsearch/index/reindex/AbstractBulkByScrollRequest.java @@ -94,9 +94,9 @@ public abstract class AbstractBulkByScrollRequest { - "script" : "return ctx.bytes_in + ctx.bytes_out" + "script" : "ctx.bytes_total = ctx.bytes_in + ctx.bytes_out" } - match: { acknowledged: true } @@ -93,7 +91,6 @@ "processors": [ { "script" : { - "field" : "bytes_total", "lang" : "painless", "id" : "sum_bytes" } diff --git a/qa/smoke-test-ingest-with-all-dependencies/src/test/resources/scripts/master.painless b/qa/smoke-test-ingest-with-all-dependencies/src/test/resources/scripts/master.painless index ebac61e3879..29880e8fd5f 100644 --- a/qa/smoke-test-ingest-with-all-dependencies/src/test/resources/scripts/master.painless +++ b/qa/smoke-test-ingest-with-all-dependencies/src/test/resources/scripts/master.painless @@ -1 +1 @@ -return ctx.bytes_in + ctx.bytes_out \ No newline at end of file +ctx.bytes_total = ctx.bytes_in + ctx.bytes_out \ No newline at end of file diff --git a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/10_basic.yaml b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/10_basic.yaml index 9077bc42efa..e599ae43b92 100644 --- a/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/10_basic.yaml +++ b/rest-api-spec/src/main/resources/rest-api-spec/test/indices.put_template/10_basic.yaml @@ -70,51 +70,3 @@ settings: number_of_shards: 1 number_of_replicas: 0 ---- -"Put template with analyzer alias": - - - do: - indices.put_template: - name: test - create: true - order: 0 - body: - template: test_* - settings: - index.analysis.analyzer.foobar.alias: "default" - index.analysis.analyzer.foobar.type: "keyword" - index.analysis.analyzer.foobar_search.alias: "default_search" - index.analysis.analyzer.foobar_search.type: "standard" - - - do: - index: - index: test_index - type: test - body: { field: "the quick brown fox" } - - - do: - indices.refresh: - index: test_index - - - do: - search: - index: test_index - type: test - body: - query: - term: - field: "the quick brown fox" - - - match: {hits.total: 1} - - - do: - search: - index: test_index - type: test - body: - query: - match: - field: "the quick brown fox" - - - match: {hits.total: 0} -