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 1db66f1d8ad49..3f304b618a5c9 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.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 7b05b0cf731cb..c55d6f1662c82 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 @@ 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 @@ protected void setupInnerHitsContext(QueryShardContext queryShardContext, 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 b3292fffaa198..0a17000c92254 100644 --- a/server/src/main/java/org/elasticsearch/search/DefaultSearchContext.java +++ b/server/src/main/java/org/elasticsearch/search/DefaultSearchContext.java @@ -57,7 +57,7 @@ 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; @@ -111,7 +111,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; @@ -459,13 +459,13 @@ public SearchContext fetchSourceContext(FetchSourceContext fetchSourceContext) { } @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 0d5de295301af..dd1526419e2f3 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.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 @@ private void registerMovingAverageModel(SearchExtensionSpec 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 b175149a560c3..20ed470ac28c0 100644 --- a/server/src/main/java/org/elasticsearch/search/SearchService.java +++ b/server/src/main/java/org/elasticsearch/search/SearchService.java @@ -77,7 +77,7 @@ 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; @@ -822,11 +822,11 @@ private void parseSource(DefaultSearchContext context, SearchSourceBuilder sourc 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(); @@ -836,7 +836,7 @@ private void parseSource(DefaultSearchContext context, SearchSourceBuilder sourc + "] 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 faaa7d733912e..7c32ef3b4ef61 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.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 e5cd4c8cc1b5b..d377c1ac8efcc 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.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 @@ public Aggregator createInternal(SearchContext searchContext, 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 7085e5ba5868c..d786cc2f9e3ba 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.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 0b0c740f5c47f..93501678e43ed 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.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 a869c4fefbc35..8c76270e78b19 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 @@ /** * 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 daafe0970290b..0e9576fd9b0e4 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 @@ /** * 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 boolean equals(Object obj) { 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 261742331f7d8..7d1d4b9dfeb97 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.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.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 void hitsExecute(SearchContext context, SearchHit[] hits) throws IOExcept 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 void hitsExecute(SearchContext context, SearchHit[] hits) throws IOExcept "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 3a6db72d5b31a..fe2a79513bc39 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.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 fa099392f40e7..1bdd742106679 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 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 baa0c6e9551e4..3c81af09be3ed 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.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 3921e6ce53678..54b569ef306f1 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.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 c2f6980781dba..9302f6d9d637d 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.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 532441c0cf934..7a015811bd1f0 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.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 void hitsExecute(SearchContext context, SearchHit[] hits) throws IOExcept 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 31a6328ff9574..d8e1f060070a2 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.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 c0477ece69aa0..4473546f76d15 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.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 InnerHitsContext innerHits() { 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 e918aed603750..a539a77d66be8 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.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 SearchContext fetchSourceContext(FetchSourceContext fetchSourceContext) { } @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 40fa7ff6d9504..6e3ee58c2207c 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.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 1f351fae3121a..d2a8b9dd5335f 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.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 List> g 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 12675b8e178e7..d87d21c7d0e5d 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 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 @@ private FetchSubPhase.HitContext hitExecuteMultiple(XContentBuilder source, bool 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 ca4d956ac61f7..9e7783741ad20 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 @@ -68,8 +68,8 @@ 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; @@ -194,7 +194,7 @@ public boolean shouldCache(Query query) { 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 d12c221cd0b48..e7b5e937c0c02 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.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 SearchContext fetchSourceContext(FetchSourceContext fetchSourceContext) { } @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/sql/src/main/java/org/elasticsearch/xpack/sql/execution/search/SqlSourceBuilder.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/execution/search/SqlSourceBuilder.java index 1872748c328fa..ad02a5640f716 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/execution/search/SqlSourceBuilder.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/execution/search/SqlSourceBuilder.java @@ -8,7 +8,7 @@ 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 9e56f46949ff6..ce861d8f81a38 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.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 void testSqlTranslateActionLicense() throws Exception { .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 742db4eca5d12..251028be6b2f4 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 @@ 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 void testSqlTranslateAction() { 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()); }