ExAliyunOts.Search.bool_query

You're seeing just the function bool_query, go back to ExAliyunOts.Search module for more information.

Specs

bool_query(options()) :: map()

Use BoolQuery as the nested :query option of :search_query option in ExAliyunOts.search/4.

Official document in Chinese | English

Example

import MyApp.TableStore

search "table", "index_name",
  search_query: [
    query: bool_query(
      must: range_query("age", from: 20, to: 32),
      must_not: term_query("age", 28)
    )
  ]

The following options can be a single Query or a list of Query to combine the "And | Or | At least" search condition.

Options

  • :must, specifies the Queries that the query result must match, this option is equivalent to the AND operator.
  • :must_not, specifies the Queries that the query result must not match, this option is equivalent to the NOT operator.
  • :should, specifies the Queries that the query result may or may not match, this option is equivalent to the OR operator.
  • :minimum_should_match, specifies the minimum number of :should that the query result must match.