java.lang.Object
co.elastic.clients.elasticsearch._types.query_dsl.Query
All Implemented Interfaces:
AggregationVariant, JsonpSerializable, OpenTaggedUnion<Query.Kind,​java.lang.Object>, TaggedUnion<Query.Kind,​java.lang.Object>

@JsonpDeserializable
public class Query
extends java.lang.Object
implements OpenTaggedUnion<Query.Kind,​java.lang.Object>, AggregationVariant, JsonpSerializable
See Also:
Documentation on elastic.co, API specification
  • Field Details

  • Constructor Details

  • Method Details

    • _aggregationKind

      public Aggregation.Kind _aggregationKind()
      Aggregation variant kind.
      Specified by:
      _aggregationKind in interface AggregationVariant
    • _kind

      public final Query.Kind _kind()
      Description copied from interface: TaggedUnion
      Get the of the kind of variant held by this object.
      Specified by:
      _kind in interface TaggedUnion<Query.Kind,​java.lang.Object>
      Returns:
      the variant kind
    • _get

      public final java.lang.Object _get()
      Specified by:
      _get in interface TaggedUnion<Query.Kind,​java.lang.Object>
    • of

      public static Query of​(java.util.function.Function<Query.Builder,​ObjectBuilder<Query>> fn)
    • isBool

      public boolean isBool()
      Is this variant instance of kind bool?
    • bool

      public BoolQuery bool()
      Get the bool variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the bool kind.
    • isBoosting

      public boolean isBoosting()
      Is this variant instance of kind boosting?
    • boosting

      public BoostingQuery boosting()
      Get the boosting variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the boosting kind.
    • isCommon

      public boolean isCommon()
      Is this variant instance of kind common?
    • common

      public CommonTermsQuery common()
      Get the common variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the common kind.
    • isCombinedFields

      public boolean isCombinedFields()
      Is this variant instance of kind combined_fields?
    • combinedFields

      public CombinedFieldsQuery combinedFields()
      Get the combined_fields variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the combined_fields kind.
    • isConstantScore

      public boolean isConstantScore()
      Is this variant instance of kind constant_score?
    • constantScore

      public ConstantScoreQuery constantScore()
      Get the constant_score variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the constant_score kind.
    • isDisMax

      public boolean isDisMax()
      Is this variant instance of kind dis_max?
    • disMax

      public DisMaxQuery disMax()
      Get the dis_max variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the dis_max kind.
    • isDistanceFeature

      public boolean isDistanceFeature()
      Is this variant instance of kind distance_feature?
    • distanceFeature

      public DistanceFeatureQuery distanceFeature()
      Get the distance_feature variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the distance_feature kind.
    • isExists

      public boolean isExists()
      Is this variant instance of kind exists?
    • exists

      public ExistsQuery exists()
      Get the exists variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the exists kind.
    • isFunctionScore

      public boolean isFunctionScore()
      Is this variant instance of kind function_score?
    • functionScore

      public FunctionScoreQuery functionScore()
      Get the function_score variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the function_score kind.
    • isFuzzy

      public boolean isFuzzy()
      Is this variant instance of kind fuzzy?
    • fuzzy

      public FuzzyQuery fuzzy()
      Get the fuzzy variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the fuzzy kind.
    • isGeoBoundingBox

      public boolean isGeoBoundingBox()
      Is this variant instance of kind geo_bounding_box?
    • geoBoundingBox

      public GeoBoundingBoxQuery geoBoundingBox()
      Get the geo_bounding_box variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the geo_bounding_box kind.
    • isGeoDistance

      public boolean isGeoDistance()
      Is this variant instance of kind geo_distance?
    • geoDistance

      public GeoDistanceQuery geoDistance()
      Get the geo_distance variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the geo_distance kind.
    • isGeoPolygon

      public boolean isGeoPolygon()
      Is this variant instance of kind geo_polygon?
    • geoPolygon

      public GeoPolygonQuery geoPolygon()
      Get the geo_polygon variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the geo_polygon kind.
    • isGeoShape

      public boolean isGeoShape()
      Is this variant instance of kind geo_shape?
    • geoShape

      public GeoShapeQuery geoShape()
      Get the geo_shape variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the geo_shape kind.
    • isHasChild

      public boolean isHasChild()
      Is this variant instance of kind has_child?
    • hasChild

      public HasChildQuery hasChild()
      Get the has_child variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the has_child kind.
    • isHasParent

      public boolean isHasParent()
      Is this variant instance of kind has_parent?
    • hasParent

      public HasParentQuery hasParent()
      Get the has_parent variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the has_parent kind.
    • isIds

      public boolean isIds()
      Is this variant instance of kind ids?
    • ids

      public IdsQuery ids()
      Get the ids variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the ids kind.
    • isIntervals

      public boolean isIntervals()
      Is this variant instance of kind intervals?
    • intervals

      public IntervalsQuery intervals()
      Get the intervals variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the intervals kind.
    • isMatch

      public boolean isMatch()
      Is this variant instance of kind match?
    • match

      public MatchQuery match()
      Get the match variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the match kind.
    • isMatchAll

      public boolean isMatchAll()
      Is this variant instance of kind match_all?
    • matchAll

      public MatchAllQuery matchAll()
      Get the match_all variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the match_all kind.
    • isMatchBoolPrefix

      public boolean isMatchBoolPrefix()
      Is this variant instance of kind match_bool_prefix?
    • matchBoolPrefix

      public MatchBoolPrefixQuery matchBoolPrefix()
      Get the match_bool_prefix variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the match_bool_prefix kind.
    • isMatchNone

      public boolean isMatchNone()
      Is this variant instance of kind match_none?
    • matchNone

      public MatchNoneQuery matchNone()
      Get the match_none variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the match_none kind.
    • isMatchPhrase

      public boolean isMatchPhrase()
      Is this variant instance of kind match_phrase?
    • matchPhrase

      public MatchPhraseQuery matchPhrase()
      Get the match_phrase variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the match_phrase kind.
    • isMatchPhrasePrefix

      public boolean isMatchPhrasePrefix()
      Is this variant instance of kind match_phrase_prefix?
    • matchPhrasePrefix

      public MatchPhrasePrefixQuery matchPhrasePrefix()
      Get the match_phrase_prefix variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the match_phrase_prefix kind.
    • isMoreLikeThis

      public boolean isMoreLikeThis()
      Is this variant instance of kind more_like_this?
    • moreLikeThis

      public MoreLikeThisQuery moreLikeThis()
      Get the more_like_this variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the more_like_this kind.
    • isMultiMatch

      public boolean isMultiMatch()
      Is this variant instance of kind multi_match?
    • multiMatch

      public MultiMatchQuery multiMatch()
      Get the multi_match variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the multi_match kind.
    • isNested

      public boolean isNested()
      Is this variant instance of kind nested?
    • nested

      public NestedQuery nested()
      Get the nested variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the nested kind.
    • isParentId

      public boolean isParentId()
      Is this variant instance of kind parent_id?
    • parentId

      public ParentIdQuery parentId()
      Get the parent_id variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the parent_id kind.
    • isPercolate

      public boolean isPercolate()
      Is this variant instance of kind percolate?
    • percolate

      public PercolateQuery percolate()
      Get the percolate variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the percolate kind.
    • isPinned

      public boolean isPinned()
      Is this variant instance of kind pinned?
    • pinned

      public PinnedQuery pinned()
      Get the pinned variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the pinned kind.
    • isPrefix

      public boolean isPrefix()
      Is this variant instance of kind prefix?
    • prefix

      public PrefixQuery prefix()
      Get the prefix variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the prefix kind.
    • isQueryString

      public boolean isQueryString()
      Is this variant instance of kind query_string?
    • queryString

      public QueryStringQuery queryString()
      Get the query_string variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the query_string kind.
    • isRange

      public boolean isRange()
      Is this variant instance of kind range?
    • range

      public RangeQuery range()
      Get the range variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the range kind.
    • isRankFeature

      public boolean isRankFeature()
      Is this variant instance of kind rank_feature?
    • rankFeature

      public RankFeatureQuery rankFeature()
      Get the rank_feature variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the rank_feature kind.
    • isRegexp

      public boolean isRegexp()
      Is this variant instance of kind regexp?
    • regexp

      public RegexpQuery regexp()
      Get the regexp variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the regexp kind.
    • isScript

      public boolean isScript()
      Is this variant instance of kind script?
    • script

      public ScriptQuery script()
      Get the script variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the script kind.
    • isScriptScore

      public boolean isScriptScore()
      Is this variant instance of kind script_score?
    • scriptScore

      public ScriptScoreQuery scriptScore()
      Get the script_score variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the script_score kind.
    • isShape

      public boolean isShape()
      Is this variant instance of kind shape?
    • shape

      public ShapeQuery shape()
      Get the shape variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the shape kind.
    • isSimpleQueryString

      public boolean isSimpleQueryString()
      Is this variant instance of kind simple_query_string?
    • simpleQueryString

      public SimpleQueryStringQuery simpleQueryString()
      Get the simple_query_string variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the simple_query_string kind.
    • isSpanContaining

      public boolean isSpanContaining()
      Is this variant instance of kind span_containing?
    • spanContaining

      public SpanContainingQuery spanContaining()
      Get the span_containing variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the span_containing kind.
    • isFieldMaskingSpan

      public boolean isFieldMaskingSpan()
      Is this variant instance of kind field_masking_span?
    • fieldMaskingSpan

      public SpanFieldMaskingQuery fieldMaskingSpan()
      Get the field_masking_span variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the field_masking_span kind.
    • isSpanFirst

      public boolean isSpanFirst()
      Is this variant instance of kind span_first?
    • spanFirst

      public SpanFirstQuery spanFirst()
      Get the span_first variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the span_first kind.
    • isSpanMulti

      public boolean isSpanMulti()
      Is this variant instance of kind span_multi?
    • spanMulti

      public SpanMultiTermQuery spanMulti()
      Get the span_multi variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the span_multi kind.
    • isSpanNear

      public boolean isSpanNear()
      Is this variant instance of kind span_near?
    • spanNear

      public SpanNearQuery spanNear()
      Get the span_near variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the span_near kind.
    • isSpanNot

      public boolean isSpanNot()
      Is this variant instance of kind span_not?
    • spanNot

      public SpanNotQuery spanNot()
      Get the span_not variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the span_not kind.
    • isSpanOr

      public boolean isSpanOr()
      Is this variant instance of kind span_or?
    • spanOr

      public SpanOrQuery spanOr()
      Get the span_or variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the span_or kind.
    • isSpanTerm

      public boolean isSpanTerm()
      Is this variant instance of kind span_term?
    • spanTerm

      public SpanTermQuery spanTerm()
      Get the span_term variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the span_term kind.
    • isSpanWithin

      public boolean isSpanWithin()
      Is this variant instance of kind span_within?
    • spanWithin

      public SpanWithinQuery spanWithin()
      Get the span_within variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the span_within kind.
    • isTerm

      public boolean isTerm()
      Is this variant instance of kind term?
    • term

      public TermQuery term()
      Get the term variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the term kind.
    • isTerms

      public boolean isTerms()
      Is this variant instance of kind terms?
    • terms

      public TermsQuery terms()
      Get the terms variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the terms kind.
    • isTermsSet

      public boolean isTermsSet()
      Is this variant instance of kind terms_set?
    • termsSet

      public TermsSetQuery termsSet()
      Get the terms_set variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the terms_set kind.
    • isWildcard

      public boolean isWildcard()
      Is this variant instance of kind wildcard?
    • wildcard

      public WildcardQuery wildcard()
      Get the wildcard variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the wildcard kind.
    • isWrapper

      public boolean isWrapper()
      Is this variant instance of kind wrapper?
    • wrapper

      public WrapperQuery wrapper()
      Get the wrapper variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the wrapper kind.
    • isType

      public boolean isType()
      Is this variant instance of kind type?
    • type

      public TypeQuery type()
      Get the type variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not of the type kind.
    • _isCustom

      public boolean _isCustom()
      Is this a custom Query defined by a plugin?
    • _customKind

      @Nullable public final java.lang.String _customKind()
      Get the actual kind when _kind() equals Query.Kind._Custom (plugin-defined variant).
      Specified by:
      _customKind in interface OpenTaggedUnion<Query.Kind,​java.lang.Object>
    • _custom

      public JsonData _custom()
      Get the custom plugin-defined variant value.
      Throws:
      java.lang.IllegalStateException - if the current variant is not Query.Kind._Custom.
    • serialize

      public void serialize​(jakarta.json.stream.JsonGenerator generator, JsonpMapper mapper)
      Specified by:
      serialize in interface JsonpSerializable
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • setupQueryDeserializer

      protected static void setupQueryDeserializer​(ObjectDeserializer<Query.Builder> op)