ExAliyunOts.Search.range_query

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

range_query(field_name, options)

View Source

Specs

range_query(field_name(), Range.t() | options()) :: map()

Use RangeQuery 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: range_query(
      "score",
      from: 60,
      to: 80,
      include_upper: false,
      include_lower: false
    )
  ]

# or support Range

search "table", "index_name",

search_query: [
  query: range_query("score", 60..80)
]

# equal to

search "table", "index_name",

search_query: [
  query: range_query("score", from: 60, to: 80)
]

Options

  • :from, the value of the start position.
  • :to, the value of the end position.
  • :include_lower, specifies whether to include the :from value in the result, available options are true | false, by default it's true.
  • :include_upper, specifies whether to include the :to value in the result, available options are true | false, by default it's true.