Package org.elasticsearch.index.query
Interface Rewriteable<T>
- All Known Subinterfaces:
MultiTermQueryBuilder,QueryBuilder,SpanQueryBuilder
- All Known Implementing Classes:
AbstractGeometryQueryBuilder,AbstractHighlighterBuilder,AbstractQueryBuilder,AliasFilter,BaseTermQueryBuilder,BoolQueryBuilder,BoostingQueryBuilder,CommonTermsQueryBuilder,ConstantScoreQueryBuilder,DisMaxQueryBuilder,DistanceFeatureQueryBuilder,ExistsQueryBuilder,FieldMaskingSpanQueryBuilder,FieldSortBuilder,FunctionScoreQueryBuilder,FuzzyQueryBuilder,GeoBoundingBoxQueryBuilder,GeoDistanceQueryBuilder,GeoDistanceSortBuilder,GeoPolygonQueryBuilder,GeoShapeQueryBuilder,HighlightBuilder,HighlightBuilder.Field,IdsQueryBuilder,IntervalQueryBuilder,MatchAllQueryBuilder,MatchBoolPrefixQueryBuilder,MatchNoneQueryBuilder,MatchPhrasePrefixQueryBuilder,MatchPhraseQueryBuilder,MatchQueryBuilder,MoreLikeThisQueryBuilder,MultiMatchQueryBuilder,NestedQueryBuilder,PrefixQueryBuilder,QueryRescorerBuilder,QueryStringQueryBuilder,RangeQueryBuilder,RegexpQueryBuilder,RescorerBuilder,ScoreSortBuilder,ScriptQueryBuilder,ScriptScoreQueryBuilder,ScriptSortBuilder,SearchSourceBuilder,SimpleQueryStringBuilder,SortBuilder,SpanContainingQueryBuilder,SpanFirstQueryBuilder,SpanMultiTermQueryBuilder,SpanNearQueryBuilder,SpanNearQueryBuilder.SpanGapQueryBuilder,SpanNotQueryBuilder,SpanOrQueryBuilder,SpanTermQueryBuilder,SpanWithinQueryBuilder,TermQueryBuilder,TermsQueryBuilder,TermsSetQueryBuilder,TypeQueryBuilder,WildcardQueryBuilder,WrapperQueryBuilder
public interface Rewriteable<T>
A basic interface for rewriteable classes.
-
Field Summary
Fields Modifier and Type Field Description static intMAX_REWRITE_ROUNDS -
Method Summary
Modifier and Type Method Description static <T extends Rewriteable<T>>
java.util.List<T>rewrite(java.util.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.Trewrite(QueryRewriteContext ctx)Rewrites this instance based on the provided context.static <T extends Rewriteable<T>>
Trewrite(T original, QueryRewriteContext context)Rewrites the givenRewriteableinto its primitive form.static <T extends Rewriteable<T>>
Trewrite(T original, QueryRewriteContext context, boolean assertNoAsyncTasks)Rewrites the givenRewriteableinto 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:
java.io.IOException
-
rewrite
static <T extends Rewriteable<T>> T rewrite(T original, QueryRewriteContext context) throws java.io.IOExceptionRewrites the givenRewriteableinto 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:
java.io.IOException- if anIOExceptionoccurs
-
rewrite
static <T extends Rewriteable<T>> T rewrite(T original, QueryRewriteContext context, boolean assertNoAsyncTasks) throws java.io.IOExceptionRewrites the givenRewriteableinto 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- iftruethe rewrite will fail if there are any pending async tasks on the context after the rewrite. SeeQueryRewriteContext.executeAsyncActions(ActionListener)for detals- Throws:
java.io.IOException- if anIOExceptionoccurs
-
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>> java.util.List<T> rewrite(java.util.List<T> rewritables, QueryRewriteContext context) throws java.io.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:
java.io.IOException
-