ExAliyunOts.create_index

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

create_index(instance, table_name, index_name, primary_keys, defined_columns, options \\ [])

View Source

Specs

create_index(
  instance(),
  table_name(),
  index_name(),
  primary_keys :: [String.t()],
  defined_columns :: [String.t()],
  options()
) :: :ok | {:error, ExAliyunOts.Error.t()}

Create global secondary indexes. Official document in Chinese | English

Example

create_index "table_name",
  "table_index_name1"
  ["pk1", "pk2", "col0"],
  ["col1", "col2"]

create_index "table_name",
  "table_index_name2"
  ["col0", "pk1"],
  ["col1", "col2", "col3"],
  include_base_data: false

Options

  • :index_update_mode, the update mode of the index table, optional, currently only support :IUM_ASYNC_INDEX, by default it is :IUM_ASYNC_INDEX;
  • :index_type, the type of the index table, optional, currently only support :IT_GLOBAL_INDEX, by default it is :IT_GLOBAL_INDEX;
  • :include_base_data, specifies whether the index table includes the existing data in the base table, if set it to true means the index includes the existing data, if set it to false means the index excludes the existing data, optional, by default it is true.