Package org.elasticsearch.index.query
Interface Rewriteable<T>
- All Known Subinterfaces:
MultiTermQueryBuilder
,QueryBuilder
,SpanQueryBuilder
- All Known Implementing Classes:
AbstractAggregationBuilder
,AbstractGeometryQueryBuilder
,AbstractHighlighterBuilder
,AbstractPercentilesAggregationBuilder
,AbstractPipelineAggregationBuilder
,AbstractQueryBuilder
,AbstractRangeBuilder
,AdjacencyMatrixAggregationBuilder
,AggregationBuilder
,AliasFilter
,AutoDateHistogramAggregationBuilder
,AvgAggregationBuilder
,AvgBucketPipelineAggregationBuilder
,BaseTermQueryBuilder
,BoolQueryBuilder
,BoostingQueryBuilder
,BucketMetricsPipelineAggregationBuilder
,BucketScriptPipelineAggregationBuilder
,BucketSelectorPipelineAggregationBuilder
,BucketSortPipelineAggregationBuilder
,CardinalityAggregationBuilder
,CombinedFieldsQueryBuilder
,CommonTermsQueryBuilder
,CompositeAggregationBuilder
,ConstantScoreQueryBuilder
,CumulativeSumPipelineAggregationBuilder
,DateHistogramAggregationBuilder
,DateRangeAggregationBuilder
,DerivativePipelineAggregationBuilder
,DisMaxQueryBuilder
,DistanceFeatureQueryBuilder
,DiversifiedAggregationBuilder
,ExistsQueryBuilder
,ExtendedStatsAggregationBuilder
,ExtendedStatsBucketPipelineAggregationBuilder
,FieldMaskingSpanQueryBuilder
,FieldSortBuilder
,FilterAggregationBuilder
,FiltersAggregationBuilder
,FunctionScoreQueryBuilder
,FuzzyQueryBuilder
,GeoBoundingBoxQueryBuilder
,GeoBoundsAggregationBuilder
,GeoCentroidAggregationBuilder
,GeoDistanceAggregationBuilder
,GeoDistanceQueryBuilder
,GeoDistanceSortBuilder
,GeoGridAggregationBuilder
,GeoHashGridAggregationBuilder
,GeoPolygonQueryBuilder
,GeoShapeQueryBuilder
,GeoTileGridAggregationBuilder
,GlobalAggregationBuilder
,HighlightBuilder
,HighlightBuilder.Field
,HistogramAggregationBuilder
,IdsQueryBuilder
,IntervalQueryBuilder
,IpRangeAggregationBuilder
,MatchAllQueryBuilder
,MatchBoolPrefixQueryBuilder
,MatchNoneQueryBuilder
,MatchPhrasePrefixQueryBuilder
,MatchPhraseQueryBuilder
,MatchQueryBuilder
,MaxAggregationBuilder
,MaxBucketPipelineAggregationBuilder
,MedianAbsoluteDeviationAggregationBuilder
,MinAggregationBuilder
,MinBucketPipelineAggregationBuilder
,MissingAggregationBuilder
,MoreLikeThisQueryBuilder
,MovAvgPipelineAggregationBuilder
,MovFnPipelineAggregationBuilder
,MultiMatchQueryBuilder
,MultiValuesSourceAggregationBuilder
,MultiValuesSourceAggregationBuilder.LeafOnly
,NestedAggregationBuilder
,NestedQueryBuilder
,PercentileRanksAggregationBuilder
,PercentilesAggregationBuilder
,PercentilesBucketPipelineAggregationBuilder
,PipelineAggregationBuilder
,PrefixQueryBuilder
,QueryRescorerBuilder
,QueryStringQueryBuilder
,RangeAggregationBuilder
,RangeQueryBuilder
,RareTermsAggregationBuilder
,RegexpQueryBuilder
,RescorerBuilder
,ReverseNestedAggregationBuilder
,SamplerAggregationBuilder
,ScoreSortBuilder
,ScriptedMetricAggregationBuilder
,ScriptQueryBuilder
,ScriptScoreQueryBuilder
,ScriptSortBuilder
,SearchRequest
,SearchSourceBuilder
,SerialDiffPipelineAggregationBuilder
,SignificantTermsAggregationBuilder
,SignificantTextAggregationBuilder
,SimpleQueryStringBuilder
,SortBuilder
,SpanContainingQueryBuilder
,SpanFirstQueryBuilder
,SpanMultiTermQueryBuilder
,SpanNearQueryBuilder
,SpanNearQueryBuilder.SpanGapQueryBuilder
,SpanNotQueryBuilder
,SpanOrQueryBuilder
,SpanTermQueryBuilder
,SpanWithinQueryBuilder
,StatsAggregationBuilder
,StatsBucketPipelineAggregationBuilder
,SumAggregationBuilder
,SumBucketPipelineAggregationBuilder
,TermQueryBuilder
,TermsAggregationBuilder
,TermsQueryBuilder
,TermsSetQueryBuilder
,TopHitsAggregationBuilder
,TypeQueryBuilder
,ValueCountAggregationBuilder
,ValuesSourceAggregationBuilder
,ValuesSourceAggregationBuilder.LeafOnly
,VariableWidthHistogramAggregationBuilder
,WeightedAvgAggregationBuilder
,WildcardQueryBuilder
,WrapperQueryBuilder
public interface Rewriteable<T>
A basic interface for rewriteable classes.
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Rewriteable<T>>
List<T>rewrite(List<T> rewritables, QueryRewriteContext context)
Rewrites each element of the list until it doesn't change and returns a new list iff there is at least one element of the list that changed during it's rewrite.Rewrites this instance based on the provided context.static <T extends Rewriteable<T>>
Trewrite(T original, QueryRewriteContext context)
Rewrites the givenRewriteable
into its primitive form.static <T extends Rewriteable<T>>
Trewrite(T original, QueryRewriteContext context, boolean assertNoAsyncTasks)
Rewrites the givenRewriteable
into its primitive form.static <T extends Rewriteable<T>>
voidrewriteAndFetch(T original, QueryRewriteContext context, ActionListener<T> rewriteResponse)
Rewrites the given rewriteable and fetches pending async tasks for each round before rewriting again.static <T extends Rewriteable<T>>
voidrewriteAndFetch(T original, QueryRewriteContext context, ActionListener<T> rewriteResponse, int iteration)
Rewrites the given rewriteable and fetches pending async tasks for each round before rewriting again.
-
Field Details
-
MAX_REWRITE_ROUNDS
static final int MAX_REWRITE_ROUNDS- See Also:
- Constant Field Values
-
-
Method Details
-
rewrite
Rewrites this instance based on the provided context. The returned objects will be the same instance as this if no changes during the rewrite were applied.- Throws:
IOException
-
rewrite
static <T extends Rewriteable<T>> T rewrite(T original, QueryRewriteContext context) throws IOExceptionRewrites the givenRewriteable
into its primitive form. Rewriteables that for instance fetch resources from remote hosts or can simplify / optimize itself should do their heavy lifting duringrewrite(QueryRewriteContext)
. This method rewrites the rewriteable until it doesn't change anymore.- Parameters:
original
- the original rewriteable to rewritecontext
- the rewrite context to use- Throws:
IOException
- if anIOException
occurs
-
rewrite
static <T extends Rewriteable<T>> T rewrite(T original, QueryRewriteContext context, boolean assertNoAsyncTasks) throws IOExceptionRewrites the givenRewriteable
into its primitive form. Rewriteables that for instance fetch resources from remote hosts or can simplify / optimize itself should do their heavy lifting duringrewriteAndFetch(Rewriteable, QueryRewriteContext, ActionListener)
(QueryRewriteContext)}. This method rewrites the rewriteable until it doesn't change anymore.- Parameters:
original
- the original rewriteable to rewritecontext
- the rewrite context to useassertNoAsyncTasks
- iftrue
the rewrite will fail if there are any pending async tasks on the context after the rewrite. SeeQueryRewriteContext.executeAsyncActions(ActionListener)
for details- Throws:
IOException
- if anIOException
occurs
-
rewriteAndFetch
static <T extends Rewriteable<T>> void rewriteAndFetch(T original, QueryRewriteContext context, ActionListener<T> rewriteResponse)Rewrites the given rewriteable and fetches pending async tasks for each round before rewriting again. -
rewriteAndFetch
static <T extends Rewriteable<T>> void rewriteAndFetch(T original, QueryRewriteContext context, ActionListener<T> rewriteResponse, int iteration)Rewrites the given rewriteable and fetches pending async tasks for each round before rewriting again. -
rewrite
static <T extends Rewriteable<T>> List<T> rewrite(List<T> rewritables, QueryRewriteContext context) throws IOExceptionRewrites each element of the list until it doesn't change and returns a new list iff there is at least one element of the list that changed during it's rewrite. Otherwise the given list instance is returned unchanged.- Throws:
IOException
-