Standardize naming of fetch subphases. (#52171)
This commit makes the names of fetch subphases more consistent: * Now the names end in just 'Phase', whereas before some ended in 'FetchSubPhase'. This matches the query subphases like AggregationPhase. * Some names include 'fetch' like FetchScorePhase to avoid ambiguity about what they do.
This commit is contained in:
parent
0da3af7581
commit
0d7165a40b
|
@ -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;
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<SearchPlugin> 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);
|
||||
|
|
|
@ -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<DocValueFieldsContext.FieldAndFormat> docValueFields = new ArrayList<>();
|
||||
for (DocValueFieldsContext.FieldAndFormat format : source.docValueFields()) {
|
||||
List<FetchDocValuesContext.FieldAndFormat> docValueFields = new ArrayList<>();
|
||||
for (FetchDocValuesContext.FieldAndFormat format : source.docValueFields()) {
|
||||
Collection<String> 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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<FetchSubPhase> 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
|
||||
|
|
|
@ -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) {
|
|
@ -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<FieldAndFormat> fields;
|
||||
|
||||
public DocValueFieldsContext(List<FieldAndFormat> fields) {
|
||||
public FetchDocValuesContext(List<FieldAndFormat> fields) {
|
||||
this.fields = fields;
|
||||
}
|
||||
|
|
@ -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) {
|
|
@ -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 {
|
|
@ -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) {
|
|
@ -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 ||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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) {
|
|
@ -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;
|
|
@ -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) {
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<FetchSubPhase> getFetchSubPhases(FetchPhaseConstructionContext context) {
|
||||
return singletonList(new ExplainFetchSubPhase());
|
||||
return singletonList(new ExplainPhase());
|
||||
}
|
||||
};
|
||||
expectThrows(IllegalArgumentException.class, registryForPlugin(registersDupeFetchSubPhase));
|
||||
|
|
|
@ -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;
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue