Class BoolQuery.Builder

All Implemented Interfaces:
WithJson<BoolQuery.Builder>, ObjectBuilder<BoolQuery>
Enclosing class:
BoolQuery

public static class BoolQuery.Builder extends QueryBase.AbstractBuilder<BoolQuery.Builder> implements ObjectBuilder<BoolQuery>
Builder for BoolQuery.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • filter

      public final BoolQuery.Builder filter(List<Query> list)
      The clause (query) must appear in matching documents. However, unlike must, the score of the query will be ignored.

      API name: filter

      Adds all elements of list to filter.

    • filter

      public final BoolQuery.Builder filter(Query value, Query... values)
      The clause (query) must appear in matching documents. However, unlike must, the score of the query will be ignored.

      API name: filter

      Adds one or more values to filter.

    • filter

      The clause (query) must appear in matching documents. However, unlike must, the score of the query will be ignored.

      API name: filter

      Adds a value to filter using a builder lambda.

    • minimumShouldMatch

      public final BoolQuery.Builder minimumShouldMatch(@Nullable String value)
      Specifies the number or percentage of should clauses returned documents must match.

      API name: minimum_should_match

    • must

      public final BoolQuery.Builder must(List<Query> list)
      The clause (query) must appear in matching documents and will contribute to the score.

      API name: must

      Adds all elements of list to must.

    • must

      public final BoolQuery.Builder must(Query value, Query... values)
      The clause (query) must appear in matching documents and will contribute to the score.

      API name: must

      Adds one or more values to must.

    • must

      The clause (query) must appear in matching documents and will contribute to the score.

      API name: must

      Adds a value to must using a builder lambda.

    • mustNot

      public final BoolQuery.Builder mustNot(List<Query> list)
      The clause (query) must not appear in the matching documents. Because scoring is ignored, a score of 0 is returned for all documents.

      API name: must_not

      Adds all elements of list to mustNot.

    • mustNot

      public final BoolQuery.Builder mustNot(Query value, Query... values)
      The clause (query) must not appear in the matching documents. Because scoring is ignored, a score of 0 is returned for all documents.

      API name: must_not

      Adds one or more values to mustNot.

    • mustNot

      The clause (query) must not appear in the matching documents. Because scoring is ignored, a score of 0 is returned for all documents.

      API name: must_not

      Adds a value to mustNot using a builder lambda.

    • should

      public final BoolQuery.Builder should(List<Query> list)
      The clause (query) should appear in the matching document.

      API name: should

      Adds all elements of list to should.

    • should

      public final BoolQuery.Builder should(Query value, Query... values)
      The clause (query) should appear in the matching document.

      API name: should

      Adds one or more values to should.

    • should

      The clause (query) should appear in the matching document.

      API name: should

      Adds a value to should using a builder lambda.

    • self

      protected BoolQuery.Builder self()
      Specified by:
      self in class QueryBase.AbstractBuilder<BoolQuery.Builder>
    • build

      public BoolQuery build()
      Builds a BoolQuery.
      Specified by:
      build in interface ObjectBuilder<BoolQuery>
      Throws:
      NullPointerException - if some of the required fields are null.
    • hasClauses

      public boolean hasClauses()
      Returns true if this query has at least one should, must, must not or filter clause.