diff --git a/server/src/main/java/org/elasticsearch/index/query/InnerHitBuilder.java b/server/src/main/java/org/elasticsearch/index/query/InnerHitBuilder.java index ef2ae2bda80..224d9d9121c 100644 --- a/server/src/main/java/org/elasticsearch/index/query/InnerHitBuilder.java +++ b/server/src/main/java/org/elasticsearch/index/query/InnerHitBuilder.java @@ -34,7 +34,7 @@ import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder.ScriptField; import org.elasticsearch.search.collapse.CollapseBuilder; import org.elasticsearch.search.fetch.StoredFieldsContext; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext.FieldAndFormat; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext.FieldAndFormat; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder; import org.elasticsearch.search.sort.SortBuilder; diff --git a/server/src/main/java/org/elasticsearch/index/query/InnerHitContextBuilder.java b/server/src/main/java/org/elasticsearch/index/query/InnerHitContextBuilder.java index 7b05b0cf731..c55d6f1662c 100644 --- a/server/src/main/java/org/elasticsearch/index/query/InnerHitContextBuilder.java +++ b/server/src/main/java/org/elasticsearch/index/query/InnerHitContextBuilder.java @@ -22,7 +22,7 @@ package org.elasticsearch.index.query; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.script.FieldScript; import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext; import org.elasticsearch.search.fetch.subphase.InnerHitsContext; import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.sort.SortAndFormats; @@ -88,7 +88,7 @@ public abstract class InnerHitContextBuilder { innerHitsContext.storedFieldsContext(innerHitBuilder.getStoredFieldsContext()); } if (innerHitBuilder.getDocValueFields() != null) { - innerHitsContext.docValueFieldsContext(new DocValueFieldsContext(innerHitBuilder.getDocValueFields())); + innerHitsContext.docValuesContext(new FetchDocValuesContext(innerHitBuilder.getDocValueFields())); } if (innerHitBuilder.getScriptFields() != null) { for (SearchSourceBuilder.ScriptField field : innerHitBuilder.getScriptFields()) { diff --git a/server/src/main/java/org/elasticsearch/search/DefaultSearchContext.java b/server/src/main/java/org/elasticsearch/search/DefaultSearchContext.java index 390a485b305..a096364d9ba 100644 --- a/server/src/main/java/org/elasticsearch/search/DefaultSearchContext.java +++ b/server/src/main/java/org/elasticsearch/search/DefaultSearchContext.java @@ -58,7 +58,7 @@ import org.elasticsearch.search.dfs.DfsSearchResult; import org.elasticsearch.search.fetch.FetchPhase; import org.elasticsearch.search.fetch.FetchSearchResult; import org.elasticsearch.search.fetch.StoredFieldsContext; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.search.fetch.subphase.ScriptFieldsContext; import org.elasticsearch.search.fetch.subphase.highlight.SearchContextHighlight; @@ -112,7 +112,7 @@ final class DefaultSearchContext extends SearchContext { private StoredFieldsContext storedFields; private ScriptFieldsContext scriptFields; private FetchSourceContext fetchSourceContext; - private DocValueFieldsContext docValueFieldsContext; + private FetchDocValuesContext docValuesContext; private int from = -1; private int size = -1; private SortAndFormats sort; @@ -465,13 +465,13 @@ final class DefaultSearchContext extends SearchContext { } @Override - public DocValueFieldsContext docValueFieldsContext() { - return docValueFieldsContext; + public FetchDocValuesContext docValuesContext() { + return docValuesContext; } @Override - public SearchContext docValueFieldsContext(DocValueFieldsContext docValueFieldsContext) { - this.docValueFieldsContext = docValueFieldsContext; + public SearchContext docValuesContext(FetchDocValuesContext docValuesContext) { + this.docValuesContext = docValuesContext; return this; } diff --git a/server/src/main/java/org/elasticsearch/search/SearchModule.java b/server/src/main/java/org/elasticsearch/search/SearchModule.java index 0d5de295301..dd1526419e2 100644 --- a/server/src/main/java/org/elasticsearch/search/SearchModule.java +++ b/server/src/main/java/org/elasticsearch/search/SearchModule.java @@ -243,14 +243,14 @@ import org.elasticsearch.search.aggregations.pipeline.SumBucketPipelineAggregati import org.elasticsearch.search.aggregations.pipeline.SumBucketPipelineAggregator; import org.elasticsearch.search.fetch.FetchPhase; import org.elasticsearch.search.fetch.FetchSubPhase; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsFetchSubPhase; -import org.elasticsearch.search.fetch.subphase.ExplainFetchSubPhase; -import org.elasticsearch.search.fetch.subphase.FetchSourceSubPhase; -import org.elasticsearch.search.fetch.subphase.MatchedQueriesFetchSubPhase; -import org.elasticsearch.search.fetch.subphase.ScoreFetchSubPhase; -import org.elasticsearch.search.fetch.subphase.ScriptFieldsFetchSubPhase; -import org.elasticsearch.search.fetch.subphase.SeqNoPrimaryTermFetchSubPhase; -import org.elasticsearch.search.fetch.subphase.VersionFetchSubPhase; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesPhase; +import org.elasticsearch.search.fetch.subphase.ExplainPhase; +import org.elasticsearch.search.fetch.subphase.FetchSourcePhase; +import org.elasticsearch.search.fetch.subphase.MatchedQueriesPhase; +import org.elasticsearch.search.fetch.subphase.FetchScorePhase; +import org.elasticsearch.search.fetch.subphase.ScriptFieldsPhase; +import org.elasticsearch.search.fetch.subphase.SeqNoPrimaryTermPhase; +import org.elasticsearch.search.fetch.subphase.FetchVersionPhase; import org.elasticsearch.search.fetch.subphase.highlight.FastVectorHighlighter; import org.elasticsearch.search.fetch.subphase.highlight.HighlightPhase; import org.elasticsearch.search.fetch.subphase.highlight.Highlighter; @@ -745,15 +745,15 @@ public class SearchModule { } private void registerFetchSubPhases(List plugins) { - registerFetchSubPhase(new ExplainFetchSubPhase()); - registerFetchSubPhase(new DocValueFieldsFetchSubPhase()); - registerFetchSubPhase(new ScriptFieldsFetchSubPhase()); - registerFetchSubPhase(new FetchSourceSubPhase()); - registerFetchSubPhase(new VersionFetchSubPhase()); - registerFetchSubPhase(new SeqNoPrimaryTermFetchSubPhase()); - registerFetchSubPhase(new MatchedQueriesFetchSubPhase()); + registerFetchSubPhase(new ExplainPhase()); + registerFetchSubPhase(new FetchDocValuesPhase()); + registerFetchSubPhase(new ScriptFieldsPhase()); + registerFetchSubPhase(new FetchSourcePhase()); + registerFetchSubPhase(new FetchVersionPhase()); + registerFetchSubPhase(new SeqNoPrimaryTermPhase()); + registerFetchSubPhase(new MatchedQueriesPhase()); registerFetchSubPhase(new HighlightPhase(highlighters)); - registerFetchSubPhase(new ScoreFetchSubPhase()); + registerFetchSubPhase(new FetchScorePhase()); FetchPhaseConstructionContext context = new FetchPhaseConstructionContext(highlighters); registerFromPlugin(plugins, p -> p.getFetchSubPhases(context), this::registerFetchSubPhase); diff --git a/server/src/main/java/org/elasticsearch/search/SearchService.java b/server/src/main/java/org/elasticsearch/search/SearchService.java index 26ce6ca598d..e4cf2d764d1 100644 --- a/server/src/main/java/org/elasticsearch/search/SearchService.java +++ b/server/src/main/java/org/elasticsearch/search/SearchService.java @@ -79,7 +79,7 @@ import org.elasticsearch.search.fetch.FetchSearchResult; import org.elasticsearch.search.fetch.QueryFetchSearchResult; import org.elasticsearch.search.fetch.ScrollQueryFetchSearchResult; import org.elasticsearch.search.fetch.ShardFetchRequest; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext; import org.elasticsearch.search.fetch.subphase.ScriptFieldsContext.ScriptField; import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder; import org.elasticsearch.search.internal.AliasFilter; @@ -884,11 +884,11 @@ public class SearchService extends AbstractLifecycleComponent implements IndexEv context.fetchSourceContext(source.fetchSource()); } if (source.docValueFields() != null) { - List docValueFields = new ArrayList<>(); - for (DocValueFieldsContext.FieldAndFormat format : source.docValueFields()) { + List docValueFields = new ArrayList<>(); + for (FetchDocValuesContext.FieldAndFormat format : source.docValueFields()) { Collection fieldNames = context.mapperService().simpleMatchToFullName(format.field); for (String fieldName: fieldNames) { - docValueFields.add(new DocValueFieldsContext.FieldAndFormat(fieldName, format.format)); + docValueFields.add(new FetchDocValuesContext.FieldAndFormat(fieldName, format.format)); } } int maxAllowedDocvalueFields = context.mapperService().getIndexSettings().getMaxDocvalueFields(); @@ -898,7 +898,7 @@ public class SearchService extends AbstractLifecycleComponent implements IndexEv + "] but was [" + docValueFields.size() + "]. This limit can be set by changing the [" + IndexSettings.MAX_DOCVALUE_FIELDS_SEARCH_SETTING.getKey() + "] index level setting."); } - context.docValueFieldsContext(new DocValueFieldsContext(docValueFields)); + context.docValuesContext(new FetchDocValuesContext(docValueFields)); } if (source.highlighter() != null) { HighlightBuilder highlightBuilder = source.highlighter(); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/TopHitsAggregationBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/TopHitsAggregationBuilder.java index faaa7d73391..7c32ef3b4ef 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/TopHitsAggregationBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/TopHitsAggregationBuilder.java @@ -39,7 +39,7 @@ import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.builder.SearchSourceBuilder; import org.elasticsearch.search.builder.SearchSourceBuilder.ScriptField; import org.elasticsearch.search.fetch.StoredFieldsContext; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext.FieldAndFormat; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext.FieldAndFormat; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.search.fetch.subphase.ScriptFieldsContext; import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder; diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/TopHitsAggregatorFactory.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/TopHitsAggregatorFactory.java index e5cd4c8cc1b..d377c1ac8ef 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/TopHitsAggregatorFactory.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/TopHitsAggregatorFactory.java @@ -25,8 +25,8 @@ import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.fetch.StoredFieldsContext; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext.FieldAndFormat; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext.FieldAndFormat; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.search.fetch.subphase.ScriptFieldsContext; import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder; @@ -107,7 +107,7 @@ class TopHitsAggregatorFactory extends AggregatorFactory { subSearchContext.storedFieldsContext(storedFieldsContext); } if (docValueFields != null) { - subSearchContext.docValueFieldsContext(new DocValueFieldsContext(docValueFields)); + subSearchContext.docValuesContext(new FetchDocValuesContext(docValueFields)); } for (ScriptFieldsContext.ScriptField field : scriptFields) { subSearchContext.scriptFields().add(field); diff --git a/server/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java b/server/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java index 7085e5ba586..d786cc2f9e3 100644 --- a/server/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java @@ -48,7 +48,7 @@ import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.PipelineAggregationBuilder; import org.elasticsearch.search.collapse.CollapseBuilder; import org.elasticsearch.search.fetch.StoredFieldsContext; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext.FieldAndFormat; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext.FieldAndFormat; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder; import org.elasticsearch.search.internal.SearchContext; diff --git a/server/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java b/server/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java index 0b0c740f5c4..93501678e43 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/FetchPhase.java @@ -55,7 +55,7 @@ import org.elasticsearch.search.SearchPhase; import org.elasticsearch.search.SearchShardTarget; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.search.fetch.subphase.InnerHitsContext; -import org.elasticsearch.search.fetch.subphase.InnerHitsFetchSubPhase; +import org.elasticsearch.search.fetch.subphase.InnerHitsPhase; import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.lookup.SourceLookup; import org.elasticsearch.tasks.TaskCancelledException; @@ -81,7 +81,7 @@ public class FetchPhase implements SearchPhase { public FetchPhase(List fetchSubPhases) { this.fetchSubPhases = fetchSubPhases.toArray(new FetchSubPhase[fetchSubPhases.size() + 1]); - this.fetchSubPhases[fetchSubPhases.size()] = new InnerHitsFetchSubPhase(this); + this.fetchSubPhases[fetchSubPhases.size()] = new InnerHitsPhase(this); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/fetch/subphase/ExplainFetchSubPhase.java b/server/src/main/java/org/elasticsearch/search/fetch/subphase/ExplainPhase.java similarity index 97% rename from server/src/main/java/org/elasticsearch/search/fetch/subphase/ExplainFetchSubPhase.java rename to server/src/main/java/org/elasticsearch/search/fetch/subphase/ExplainPhase.java index a869c4fefbc..8c76270e78b 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/subphase/ExplainFetchSubPhase.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/subphase/ExplainPhase.java @@ -29,7 +29,7 @@ import java.io.IOException; /** * Explains the scoring calculations for the top hits. */ -public final class ExplainFetchSubPhase implements FetchSubPhase { +public final class ExplainPhase implements FetchSubPhase { @Override public void hitExecute(SearchContext context, HitContext hitContext) { diff --git a/server/src/main/java/org/elasticsearch/search/fetch/subphase/DocValueFieldsContext.java b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchDocValuesContext.java similarity index 97% rename from server/src/main/java/org/elasticsearch/search/fetch/subphase/DocValueFieldsContext.java rename to server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchDocValuesContext.java index daafe097029..0e9576fd9b0 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/subphase/DocValueFieldsContext.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchDocValuesContext.java @@ -36,7 +36,7 @@ import java.util.Objects; /** * All the required context to pull a field from the doc values. */ -public class DocValueFieldsContext { +public class FetchDocValuesContext { /** * Wrapper around a field name and the format that should be used to @@ -113,7 +113,7 @@ public class DocValueFieldsContext { private final List fields; - public DocValueFieldsContext(List fields) { + public FetchDocValuesContext(List fields) { this.fields = fields; } diff --git a/server/src/main/java/org/elasticsearch/search/fetch/subphase/DocValueFieldsFetchSubPhase.java b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchDocValuesPhase.java similarity index 91% rename from server/src/main/java/org/elasticsearch/search/fetch/subphase/DocValueFieldsFetchSubPhase.java rename to server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchDocValuesPhase.java index 261742331f7..7d1d4b9dfeb 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/subphase/DocValueFieldsFetchSubPhase.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchDocValuesPhase.java @@ -35,7 +35,7 @@ import org.elasticsearch.index.mapper.MappedFieldType; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.SearchHit; import org.elasticsearch.search.fetch.FetchSubPhase; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext.FieldAndFormat; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext.FieldAndFormat; import org.elasticsearch.search.internal.SearchContext; import java.io.IOException; @@ -51,15 +51,15 @@ import static org.elasticsearch.index.fielddata.IndexNumericFieldData.NumericTyp import static org.elasticsearch.search.DocValueFormat.withNanosecondResolution; /** - * Query sub phase which pulls data from doc values + * Fetch sub phase which pulls data from doc values. * * Specifying {@code "docvalue_fields": ["field1", "field2"]} */ -public final class DocValueFieldsFetchSubPhase implements FetchSubPhase { +public final class FetchDocValuesPhase implements FetchSubPhase { private static final String USE_DEFAULT_FORMAT = "use_field_mapping"; private static final DeprecationLogger DEPRECATION_LOGGER = new DeprecationLogger( - LogManager.getLogger(DocValueFieldsFetchSubPhase.class)); + LogManager.getLogger(FetchDocValuesPhase.class)); @Override public void hitsExecute(SearchContext context, SearchHit[] hits) throws IOException { @@ -67,22 +67,22 @@ public final class DocValueFieldsFetchSubPhase implements FetchSubPhase { if (context.collapse() != null) { // retrieve the `doc_value` associated with the collapse field String name = context.collapse().getFieldName(); - if (context.docValueFieldsContext() == null) { - context.docValueFieldsContext(new DocValueFieldsContext( + if (context.docValuesContext() == null) { + context.docValuesContext(new FetchDocValuesContext( Collections.singletonList(new FieldAndFormat(name, null)))); - } else if (context.docValueFieldsContext().fields().stream().map(ff -> ff.field).anyMatch(name::equals) == false) { - context.docValueFieldsContext().fields().add(new FieldAndFormat(name, null)); + } else if (context.docValuesContext().fields().stream().map(ff -> ff.field).anyMatch(name::equals) == false) { + context.docValuesContext().fields().add(new FieldAndFormat(name, null)); } } - if (context.docValueFieldsContext() == null) { + if (context.docValuesContext() == null) { return; } hits = hits.clone(); // don't modify the incoming hits Arrays.sort(hits, Comparator.comparingInt(SearchHit::docId)); - if (context.docValueFieldsContext().fields().stream() + if (context.docValuesContext().fields().stream() .map(f -> f.format) .filter(USE_DEFAULT_FORMAT::equals) .findAny() @@ -91,7 +91,7 @@ public final class DocValueFieldsFetchSubPhase implements FetchSubPhase { "ease the transition to 7.x. It has become the default and shouldn't be set explicitly anymore."); } - for (FieldAndFormat fieldAndFormat : context.docValueFieldsContext().fields()) { + for (FieldAndFormat fieldAndFormat : context.docValuesContext().fields()) { String field = fieldAndFormat.field; MappedFieldType fieldType = context.mapperService().fieldType(field); if (fieldType != null) { diff --git a/server/src/main/java/org/elasticsearch/search/fetch/subphase/ScoreFetchSubPhase.java b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchScorePhase.java similarity index 98% rename from server/src/main/java/org/elasticsearch/search/fetch/subphase/ScoreFetchSubPhase.java rename to server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchScorePhase.java index 3a6db72d5b3..fe2a79513bc 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/subphase/ScoreFetchSubPhase.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchScorePhase.java @@ -34,7 +34,7 @@ import java.util.Arrays; import java.util.Comparator; import java.util.Iterator; -public class ScoreFetchSubPhase implements FetchSubPhase { +public class FetchScorePhase implements FetchSubPhase { @Override public void hitsExecute(SearchContext context, SearchHit[] hits) throws IOException { diff --git a/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourceSubPhase.java b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourcePhase.java similarity index 98% rename from server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourceSubPhase.java rename to server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourcePhase.java index fa099392f40..1bdd7421066 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourceSubPhase.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchSourcePhase.java @@ -31,7 +31,7 @@ import org.elasticsearch.search.lookup.SourceLookup; import java.io.IOException; import java.util.Map; -public final class FetchSourceSubPhase implements FetchSubPhase { +public final class FetchSourcePhase implements FetchSubPhase { @Override public void hitExecute(SearchContext context, HitContext hitContext) { diff --git a/server/src/main/java/org/elasticsearch/search/fetch/subphase/VersionFetchSubPhase.java b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchVersionPhase.java similarity index 97% rename from server/src/main/java/org/elasticsearch/search/fetch/subphase/VersionFetchSubPhase.java rename to server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchVersionPhase.java index baa0c6e9551..3c81af09be3 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/subphase/VersionFetchSubPhase.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/subphase/FetchVersionPhase.java @@ -31,7 +31,7 @@ import java.io.IOException; import java.util.Arrays; import java.util.Comparator; -public final class VersionFetchSubPhase implements FetchSubPhase { +public final class FetchVersionPhase implements FetchSubPhase { @Override public void hitsExecute(SearchContext context, SearchHit[] hits) throws IOException { if (context.version() == false || diff --git a/server/src/main/java/org/elasticsearch/search/fetch/subphase/InnerHitsFetchSubPhase.java b/server/src/main/java/org/elasticsearch/search/fetch/subphase/InnerHitsPhase.java similarity index 96% rename from server/src/main/java/org/elasticsearch/search/fetch/subphase/InnerHitsFetchSubPhase.java rename to server/src/main/java/org/elasticsearch/search/fetch/subphase/InnerHitsPhase.java index 3921e6ce536..54b569ef306 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/subphase/InnerHitsFetchSubPhase.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/subphase/InnerHitsPhase.java @@ -34,11 +34,11 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; -public final class InnerHitsFetchSubPhase implements FetchSubPhase { +public final class InnerHitsPhase implements FetchSubPhase { private final FetchPhase fetchPhase; - public InnerHitsFetchSubPhase(FetchPhase fetchPhase) { + public InnerHitsPhase(FetchPhase fetchPhase) { this.fetchPhase = fetchPhase; } diff --git a/server/src/main/java/org/elasticsearch/search/fetch/subphase/MatchedQueriesFetchSubPhase.java b/server/src/main/java/org/elasticsearch/search/fetch/subphase/MatchedQueriesPhase.java similarity index 98% rename from server/src/main/java/org/elasticsearch/search/fetch/subphase/MatchedQueriesFetchSubPhase.java rename to server/src/main/java/org/elasticsearch/search/fetch/subphase/MatchedQueriesPhase.java index c2f6980781d..9302f6d9d63 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/subphase/MatchedQueriesFetchSubPhase.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/subphase/MatchedQueriesPhase.java @@ -40,7 +40,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -public final class MatchedQueriesFetchSubPhase implements FetchSubPhase { +public final class MatchedQueriesPhase implements FetchSubPhase { @Override public void hitsExecute(SearchContext context, SearchHit[] hits) { diff --git a/server/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsFetchSubPhase.java b/server/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsPhase.java similarity index 97% rename from server/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsFetchSubPhase.java rename to server/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsPhase.java index 532441c0cf9..7a015811bd1 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsFetchSubPhase.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/subphase/ScriptFieldsPhase.java @@ -37,7 +37,7 @@ import java.util.Comparator; import java.util.HashMap; import java.util.List; -public final class ScriptFieldsFetchSubPhase implements FetchSubPhase { +public final class ScriptFieldsPhase implements FetchSubPhase { @Override public void hitsExecute(SearchContext context, SearchHit[] hits) throws IOException { @@ -65,7 +65,7 @@ public final class ScriptFieldsFetchSubPhase implements FetchSubPhase { final Object value; try { value = leafScripts[i].execute(); - CollectionUtils.ensureNoSelfReferences(value, "ScriptFieldsFetchSubPhase leaf script " + i); + CollectionUtils.ensureNoSelfReferences(value, "ScriptFieldsPhase leaf script " + i); } catch (RuntimeException e) { if (scriptFields.get(i).ignoreException()) { continue; diff --git a/server/src/main/java/org/elasticsearch/search/fetch/subphase/SeqNoPrimaryTermFetchSubPhase.java b/server/src/main/java/org/elasticsearch/search/fetch/subphase/SeqNoPrimaryTermPhase.java similarity index 97% rename from server/src/main/java/org/elasticsearch/search/fetch/subphase/SeqNoPrimaryTermFetchSubPhase.java rename to server/src/main/java/org/elasticsearch/search/fetch/subphase/SeqNoPrimaryTermPhase.java index 31a6328ff95..d8e1f060070 100644 --- a/server/src/main/java/org/elasticsearch/search/fetch/subphase/SeqNoPrimaryTermFetchSubPhase.java +++ b/server/src/main/java/org/elasticsearch/search/fetch/subphase/SeqNoPrimaryTermPhase.java @@ -31,7 +31,7 @@ import java.io.IOException; import java.util.Arrays; import java.util.Comparator; -public final class SeqNoPrimaryTermFetchSubPhase implements FetchSubPhase { +public final class SeqNoPrimaryTermPhase implements FetchSubPhase { @Override public void hitsExecute(SearchContext context, SearchHit[] hits) throws IOException { if (context.seqNoAndPrimaryTerm() == false) { diff --git a/server/src/main/java/org/elasticsearch/search/internal/SearchContext.java b/server/src/main/java/org/elasticsearch/search/internal/SearchContext.java index c0477ece69a..4473546f76d 100644 --- a/server/src/main/java/org/elasticsearch/search/internal/SearchContext.java +++ b/server/src/main/java/org/elasticsearch/search/internal/SearchContext.java @@ -49,7 +49,7 @@ import org.elasticsearch.search.dfs.DfsSearchResult; import org.elasticsearch.search.fetch.FetchPhase; import org.elasticsearch.search.fetch.FetchSearchResult; import org.elasticsearch.search.fetch.StoredFieldsContext; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.search.fetch.subphase.InnerHitsContext; import org.elasticsearch.search.fetch.subphase.ScriptFieldsContext; @@ -197,9 +197,9 @@ public abstract class SearchContext extends AbstractRefCounted implements Releas public abstract SearchContext fetchSourceContext(FetchSourceContext fetchSourceContext); - public abstract DocValueFieldsContext docValueFieldsContext(); + public abstract FetchDocValuesContext docValuesContext(); - public abstract SearchContext docValueFieldsContext(DocValueFieldsContext docValueFieldsContext); + public abstract SearchContext docValuesContext(FetchDocValuesContext docValuesContext); public abstract ContextIndexSearcher searcher(); diff --git a/server/src/main/java/org/elasticsearch/search/internal/SubSearchContext.java b/server/src/main/java/org/elasticsearch/search/internal/SubSearchContext.java index e918aed6037..a539a77d66b 100644 --- a/server/src/main/java/org/elasticsearch/search/internal/SubSearchContext.java +++ b/server/src/main/java/org/elasticsearch/search/internal/SubSearchContext.java @@ -25,7 +25,7 @@ import org.elasticsearch.search.aggregations.SearchContextAggregations; import org.elasticsearch.search.collapse.CollapseContext; import org.elasticsearch.search.fetch.FetchSearchResult; import org.elasticsearch.search.fetch.StoredFieldsContext; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.search.fetch.subphase.ScriptFieldsContext; import org.elasticsearch.search.fetch.subphase.highlight.SearchContextHighlight; @@ -58,7 +58,7 @@ public class SubSearchContext extends FilteredSearchContext { private StoredFieldsContext storedFields; private ScriptFieldsContext scriptFields; private FetchSourceContext fetchSourceContext; - private DocValueFieldsContext docValueFieldsContext; + private FetchDocValuesContext docValuesContext; private SearchContextHighlight highlight; private boolean explain; @@ -150,13 +150,13 @@ public class SubSearchContext extends FilteredSearchContext { } @Override - public DocValueFieldsContext docValueFieldsContext() { - return docValueFieldsContext; + public FetchDocValuesContext docValuesContext() { + return docValuesContext; } @Override - public SearchContext docValueFieldsContext(DocValueFieldsContext docValueFieldsContext) { - this.docValueFieldsContext = docValueFieldsContext; + public SearchContext docValuesContext(FetchDocValuesContext docValuesContext) { + this.docValuesContext = docValuesContext; return this; } diff --git a/server/src/test/java/org/elasticsearch/index/query/InnerHitBuilderTests.java b/server/src/test/java/org/elasticsearch/index/query/InnerHitBuilderTests.java index 40fa7ff6d95..6e3ee58c220 100644 --- a/server/src/test/java/org/elasticsearch/index/query/InnerHitBuilderTests.java +++ b/server/src/test/java/org/elasticsearch/index/query/InnerHitBuilderTests.java @@ -32,7 +32,7 @@ import org.elasticsearch.script.Script; import org.elasticsearch.script.ScriptType; import org.elasticsearch.search.SearchModule; import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext.FieldAndFormat; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext.FieldAndFormat; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilderTests; import org.elasticsearch.search.internal.ShardSearchRequest; diff --git a/server/src/test/java/org/elasticsearch/search/SearchModuleTests.java b/server/src/test/java/org/elasticsearch/search/SearchModuleTests.java index 1f351fae312..d2a8b9dd533 100644 --- a/server/src/test/java/org/elasticsearch/search/SearchModuleTests.java +++ b/server/src/test/java/org/elasticsearch/search/SearchModuleTests.java @@ -53,7 +53,7 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceAggregationBuil import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.fetch.FetchSubPhase; -import org.elasticsearch.search.fetch.subphase.ExplainFetchSubPhase; +import org.elasticsearch.search.fetch.subphase.ExplainPhase; import org.elasticsearch.search.fetch.subphase.highlight.CustomHighlighter; import org.elasticsearch.search.fetch.subphase.highlight.FastVectorHighlighter; import org.elasticsearch.search.fetch.subphase.highlight.Highlighter; @@ -137,7 +137,7 @@ public class SearchModuleTests extends ESTestCase { SearchPlugin registersDupeFetchSubPhase = new SearchPlugin() { @Override public List getFetchSubPhases(FetchPhaseConstructionContext context) { - return singletonList(new ExplainFetchSubPhase()); + return singletonList(new ExplainPhase()); } }; expectThrows(IllegalArgumentException.class, registryForPlugin(registersDupeFetchSubPhase)); diff --git a/server/src/test/java/org/elasticsearch/search/fetch/subphase/FetchSourceSubPhaseTests.java b/server/src/test/java/org/elasticsearch/search/fetch/subphase/FetchSourcePhaseTests.java similarity index 95% rename from server/src/test/java/org/elasticsearch/search/fetch/subphase/FetchSourceSubPhaseTests.java rename to server/src/test/java/org/elasticsearch/search/fetch/subphase/FetchSourcePhaseTests.java index 12675b8e178..d87d21c7d0e 100644 --- a/server/src/test/java/org/elasticsearch/search/fetch/subphase/FetchSourceSubPhaseTests.java +++ b/server/src/test/java/org/elasticsearch/search/fetch/subphase/FetchSourcePhaseTests.java @@ -39,7 +39,7 @@ import java.util.Map; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class FetchSourceSubPhaseTests extends ESTestCase { +public class FetchSourcePhaseTests extends ESTestCase { public void testFetchSource() throws IOException { XContentBuilder source = XContentFactory.jsonBuilder().startObject() @@ -149,22 +149,22 @@ public class FetchSourceSubPhaseTests extends ESTestCase { private FetchSubPhase.HitContext hitExecuteMultiple(XContentBuilder source, boolean fetchSource, String[] includes, String[] excludes, SearchHit.NestedIdentity nestedIdentity) { FetchSourceContext fetchSourceContext = new FetchSourceContext(fetchSource, includes, excludes); - SearchContext searchContext = new FetchSourceSubPhaseTestSearchContext(fetchSourceContext, + SearchContext searchContext = new FetchSourcePhaseTestSearchContext(fetchSourceContext, source == null ? null : BytesReference.bytes(source)); FetchSubPhase.HitContext hitContext = new FetchSubPhase.HitContext(); final SearchHit searchHit = new SearchHit(1, null, null, nestedIdentity, null); hitContext.reset(searchHit, null, 1, null); - FetchSourceSubPhase phase = new FetchSourceSubPhase(); + FetchSourcePhase phase = new FetchSourcePhase(); phase.hitExecute(searchContext, hitContext); return hitContext; } - private static class FetchSourceSubPhaseTestSearchContext extends TestSearchContext { + private static class FetchSourcePhaseTestSearchContext extends TestSearchContext { final FetchSourceContext context; final BytesReference source; final IndexShard indexShard; - FetchSourceSubPhaseTestSearchContext(FetchSourceContext context, BytesReference source) { + FetchSourcePhaseTestSearchContext(FetchSourceContext context, BytesReference source) { super(null); this.context = context; this.source = source; diff --git a/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java b/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java index a90a6d83c11..2d4f70cd49f 100644 --- a/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java @@ -69,8 +69,8 @@ import org.elasticsearch.script.ScriptService; import org.elasticsearch.search.aggregations.MultiBucketConsumerService.MultiBucketConsumer; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.fetch.FetchPhase; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsFetchSubPhase; -import org.elasticsearch.search.fetch.subphase.FetchSourceSubPhase; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesPhase; +import org.elasticsearch.search.fetch.subphase.FetchSourcePhase; import org.elasticsearch.search.internal.ContextIndexSearcher; import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.lookup.SearchLookup; @@ -195,7 +195,7 @@ public abstract class AggregatorTestCase extends ESTestCase { when(searchContext.numberOfShards()).thenReturn(1); when(searchContext.searcher()).thenReturn(contextIndexSearcher); when(searchContext.fetchPhase()) - .thenReturn(new FetchPhase(Arrays.asList(new FetchSourceSubPhase(), new DocValueFieldsFetchSubPhase()))); + .thenReturn(new FetchPhase(Arrays.asList(new FetchSourcePhase(), new FetchDocValuesPhase()))); when(searchContext.bitsetFilterCache()).thenReturn(new BitsetFilterCache(indexSettings, mock(Listener.class))); CircuitBreakerService circuitBreakerService = new NoneCircuitBreakerService(); IndexShard indexShard = mock(IndexShard.class); diff --git a/test/framework/src/main/java/org/elasticsearch/test/TestSearchContext.java b/test/framework/src/main/java/org/elasticsearch/test/TestSearchContext.java index d12c221cd0b..e7b5e937c0c 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/TestSearchContext.java +++ b/test/framework/src/main/java/org/elasticsearch/test/TestSearchContext.java @@ -45,7 +45,7 @@ import org.elasticsearch.search.dfs.DfsSearchResult; import org.elasticsearch.search.fetch.FetchPhase; import org.elasticsearch.search.fetch.FetchSearchResult; import org.elasticsearch.search.fetch.StoredFieldsContext; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.search.fetch.subphase.ScriptFieldsContext; import org.elasticsearch.search.fetch.subphase.highlight.SearchContextHighlight; @@ -261,12 +261,12 @@ public class TestSearchContext extends SearchContext { } @Override - public DocValueFieldsContext docValueFieldsContext() { + public FetchDocValuesContext docValuesContext() { return null; } @Override - public SearchContext docValueFieldsContext(DocValueFieldsContext docValueFieldsContext) { + public SearchContext docValuesContext(FetchDocValuesContext docValuesContext) { return null; } diff --git a/x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/execution/search/QlSourceBuilder.java b/x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/execution/search/QlSourceBuilder.java index 06bc216b812..c8e9d06d5f4 100644 --- a/x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/execution/search/QlSourceBuilder.java +++ b/x-pack/plugin/ql/src/main/java/org/elasticsearch/xpack/ql/execution/search/QlSourceBuilder.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.ql.execution.search; import org.elasticsearch.common.Strings; import org.elasticsearch.script.Script; import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext.FieldAndFormat; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext.FieldAndFormat; import java.util.LinkedHashMap; import java.util.LinkedHashSet; diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlLicenseIT.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlLicenseIT.java index 9e56f46949f..ce861d8f81a 100644 --- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlLicenseIT.java +++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlLicenseIT.java @@ -17,7 +17,7 @@ import org.elasticsearch.license.License; import org.elasticsearch.license.License.OperationMode; import org.elasticsearch.plugins.Plugin; import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.test.hamcrest.ElasticsearchAssertions; import org.elasticsearch.transport.Netty4Plugin; @@ -154,7 +154,7 @@ public class SqlLicenseIT extends AbstractLicensesIntegrationTestCase { .query("SELECT * FROM test").get(); SearchSourceBuilder source = response.source(); assertThat(source.docValueFields(), Matchers.contains( - new DocValueFieldsContext.FieldAndFormat("count", null))); + new FetchDocValuesContext.FieldAndFormat("count", null))); FetchSourceContext fetchSource = source.fetchSource(); assertThat(fetchSource.includes(), Matchers.arrayContaining("data")); } diff --git a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateActionIT.java b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateActionIT.java index 742db4eca5d..251028be6b2 100644 --- a/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateActionIT.java +++ b/x-pack/plugin/sql/src/test/java/org/elasticsearch/xpack/sql/action/SqlTranslateActionIT.java @@ -8,7 +8,7 @@ package org.elasticsearch.xpack.sql.action; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.support.WriteRequest; import org.elasticsearch.search.builder.SearchSourceBuilder; -import org.elasticsearch.search.fetch.subphase.DocValueFieldsContext; +import org.elasticsearch.search.fetch.subphase.FetchDocValuesContext; import org.elasticsearch.search.fetch.subphase.FetchSourceContext; import org.elasticsearch.search.sort.SortBuilders; @@ -35,7 +35,7 @@ public class SqlTranslateActionIT extends AbstractSqlIntegTestCase { assertTrue(fetch.fetchSource()); assertArrayEquals(new String[] { "data", "count" }, fetch.includes()); assertEquals( - singletonList(new DocValueFieldsContext.FieldAndFormat("date", "epoch_millis")), + singletonList(new FetchDocValuesContext.FieldAndFormat("date", "epoch_millis")), source.docValueFields()); assertEquals(singletonList(SortBuilders.fieldSort("count").missing("_last").unmappedType("long")), source.sorts()); }