Interface QueryBuilder

All Superinterfaces:
NamedWriteable, Rewriteable<QueryBuilder>, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject, Writeable
All Known Subinterfaces:
MultiTermQueryBuilder, SpanQueryBuilder
All Known Implementing Classes:
AbstractGeometryQueryBuilder, AbstractQueryBuilder, BaseTermQueryBuilder, BoolQueryBuilder, BoostingQueryBuilder, CommonTermsQueryBuilder, ConstantScoreQueryBuilder, DisMaxQueryBuilder, DistanceFeatureQueryBuilder, ExistsQueryBuilder, FieldMaskingSpanQueryBuilder, FunctionScoreQueryBuilder, FuzzyQueryBuilder, GeoBoundingBoxQueryBuilder, GeoDistanceQueryBuilder, GeoPolygonQueryBuilder, GeoShapeQueryBuilder, IdsQueryBuilder, IntervalQueryBuilder, MatchAllQueryBuilder, MatchBoolPrefixQueryBuilder, MatchNoneQueryBuilder, MatchPhrasePrefixQueryBuilder, MatchPhraseQueryBuilder, MatchQueryBuilder, MoreLikeThisQueryBuilder, MultiMatchQueryBuilder, NestedQueryBuilder, PrefixQueryBuilder, QueryStringQueryBuilder, RangeQueryBuilder, RegexpQueryBuilder, ScriptQueryBuilder, ScriptScoreQueryBuilder, SimpleQueryStringBuilder, SpanContainingQueryBuilder, SpanFirstQueryBuilder, SpanMultiTermQueryBuilder, SpanNearQueryBuilder, SpanNearQueryBuilder.SpanGapQueryBuilder, SpanNotQueryBuilder, SpanOrQueryBuilder, SpanTermQueryBuilder, SpanWithinQueryBuilder, TermQueryBuilder, TermsQueryBuilder, TermsSetQueryBuilder, TypeQueryBuilder, WildcardQueryBuilder, WrapperQueryBuilder

public interface QueryBuilder
extends NamedWriteable, org.elasticsearch.common.xcontent.ToXContentObject, Rewriteable<QueryBuilder>
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.elasticsearch.common.xcontent.ToXContent

    org.elasticsearch.common.xcontent.ToXContent.DelegatingMapParams, org.elasticsearch.common.xcontent.ToXContent.MapParams, org.elasticsearch.common.xcontent.ToXContent.Params

    Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable

    Writeable.Reader<V>, Writeable.Writer<V>
  • Field Summary

    Fields inherited from interface org.elasticsearch.index.query.Rewriteable

    MAX_REWRITE_ROUNDS

    Fields inherited from interface org.elasticsearch.common.xcontent.ToXContent

    EMPTY_PARAMS
  • Method Summary

    Modifier and Type Method Description
    float boost()
    Returns the boost for this query.
    QueryBuilder boost​(float boost)
    Sets the boost for this query.
    java.lang.String getName()
    Returns the name that identifies uniquely the query
    java.lang.String queryName()
    Returns the arbitrary name assigned to the query (see named queries).
    QueryBuilder queryName​(java.lang.String queryName)
    Sets the arbitrary name to be assigned to the query (see named queries).
    default QueryBuilder rewrite​(QueryRewriteContext queryShardContext)
    Rewrites this query builder into its primitive form.
    org.apache.lucene.search.Query toQuery​(QueryShardContext context)
    Converts this QueryBuilder to a lucene Query.

    Methods inherited from interface org.elasticsearch.common.io.stream.NamedWriteable

    getWriteableName

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContent

    toXContent

    Methods inherited from interface org.elasticsearch.common.xcontent.ToXContentObject

    isFragment

    Methods inherited from interface org.elasticsearch.common.io.stream.Writeable

    writeTo
  • Method Details

    • toQuery

      org.apache.lucene.search.Query toQuery​(QueryShardContext context) throws java.io.IOException
      Converts this QueryBuilder to a lucene Query. Returns null if this query should be ignored in the context of parent queries.
      Parameters:
      context - additional information needed to construct the queries
      Returns:
      the Query or null if this query should be ignored upstream
      Throws:
      java.io.IOException
    • queryName

      QueryBuilder queryName​(java.lang.String queryName)
      Sets the arbitrary name to be assigned to the query (see named queries). Implementers should return the concrete type of the QueryBuilder so that calls can be chained. This is done automatically when extending AbstractQueryBuilder.
    • queryName

      java.lang.String queryName()
      Returns the arbitrary name assigned to the query (see named queries).
    • boost

      float boost()
      Returns the boost for this query.
    • boost

      QueryBuilder boost​(float boost)
      Sets the boost for this query. Documents matching this query will (in addition to the normal weightings) have their score multiplied by the boost provided. Implementers should return the concrete type of the QueryBuilder so that calls can be chained. This is done automatically when extending AbstractQueryBuilder.
    • getName

      java.lang.String getName()
      Returns the name that identifies uniquely the query
    • rewrite

      default QueryBuilder rewrite​(QueryRewriteContext queryShardContext) throws java.io.IOException
      Rewrites this query builder into its primitive form. By default this method return the builder itself. If the builder did not change the identity reference must be returned otherwise the builder will be rewritten infinitely.
      Specified by:
      rewrite in interface Rewriteable<QueryBuilder>
      Throws:
      java.io.IOException