Class NestedQueryBuilder

All Implemented Interfaces:
NamedWriteable, Writeable, org.elasticsearch.common.xcontent.ToXContent, org.elasticsearch.common.xcontent.ToXContentObject, QueryBuilder, Rewriteable<QueryBuilder>

public class NestedQueryBuilder
extends AbstractQueryBuilder<NestedQueryBuilder>
  • Field Details

    • NAME

      public static final java.lang.String NAME
      See Also:
      Constant Field Values

      public static final boolean DEFAULT_IGNORE_UNMAPPED
      The default value for ignore_unmapped.
      See Also:
      Constant Field Values
  • Constructor Details

    • NestedQueryBuilder

      public NestedQueryBuilder​(java.lang.String path, QueryBuilder query, scoreMode)
    • NestedQueryBuilder

      public NestedQueryBuilder​(StreamInput in) throws
      Read from a stream.
  • Method Details

    • doWriteTo

      protected void doWriteTo​(StreamOutput out) throws
      Specified by:
      doWriteTo in class AbstractQueryBuilder<NestedQueryBuilder>
    • query

      public QueryBuilder query()
      Returns the nested query to execute.
    • innerHit

      public InnerHitBuilder innerHit()
      Returns inner hit definition in the scope of this query and reusing the defined type and query.
    • innerHit

      public NestedQueryBuilder innerHit​(InnerHitBuilder innerHitBuilder)
    • scoreMode

      public scoreMode()
      Returns how the scores from the matching child documents are mapped into the nested parent document.
    • ignoreUnmapped

      public NestedQueryBuilder ignoreUnmapped​(boolean ignoreUnmapped)
      Sets whether the query builder should ignore unmapped paths (and run a MatchNoDocsQuery in place of this query) or throw an exception if the path is unmapped.
    • ignoreUnmapped

      public boolean ignoreUnmapped()
      Gets whether the query builder will ignore unmapped fields (and run a MatchNoDocsQuery in place of this query) or throw an exception if the path is unmapped.
    • doXContent

      protected void doXContent​(org.elasticsearch.common.xcontent.XContentBuilder builder, org.elasticsearch.common.xcontent.ToXContent.Params params) throws
      Specified by:
      doXContent in class AbstractQueryBuilder<NestedQueryBuilder>
    • fromXContent

      public static NestedQueryBuilder fromXContent​(org.elasticsearch.common.xcontent.XContentParser parser) throws
    • parseScoreMode

      public static parseScoreMode​(java.lang.String scoreModeString)
    • scoreModeAsString

      public static java.lang.String scoreModeAsString​( scoreMode)
    • getWriteableName

      public final java.lang.String getWriteableName()
      Description copied from interface: NamedWriteable
      Returns the name of the writeable object
    • doEquals

      protected boolean doEquals​(NestedQueryBuilder that)
      Description copied from class: AbstractQueryBuilder
      Indicates whether some other QueryBuilder object of the same type is "equal to" this one.
      Specified by:
      doEquals in class AbstractQueryBuilder<NestedQueryBuilder>
    • doHashCode

      protected int doHashCode()
      Specified by:
      doHashCode in class AbstractQueryBuilder<NestedQueryBuilder>
    • doToQuery

      protected doToQuery​(SearchExecutionContext context) throws
      Specified by:
      doToQuery in class AbstractQueryBuilder<NestedQueryBuilder>
    • doRewrite

      protected QueryBuilder doRewrite​(QueryRewriteContext queryRewriteContext) throws
      doRewrite in class AbstractQueryBuilder<NestedQueryBuilder>
    • extractInnerHitBuilders

      public void extractInnerHitBuilders​(java.util.Map<java.lang.String,​InnerHitContextBuilder> innerHits)
      Description copied from class: AbstractQueryBuilder
      For internal usage only! Extracts the inner hits from the query tree. While it extracts inner hits, child inner hits are inlined into the inner hit builder they belong to.
      extractInnerHitBuilders in class AbstractQueryBuilder<NestedQueryBuilder>