This topic describes how to use the cluster management system of LindormSearch to manage collections.

Terms

  • collection: A collection is an index table in LindormSearch.
  • shard: A shard refers to a shard of a collection.
  • replica: A replica refers to a replica of a shard of a collection.

Create a collection

  1. Log on to the cluster management system provided by the search engine service that is called LindormSearch.
  2. In the left-side navigation pane, click Collections.
  3. Click Add Collection.
    Create a collection
    Configure the parameters described in the following table.
    ParameterDescription
    nameThe name of the collection.
    config setThe configuration set of the collection. Default value: _indexer_default.
    numShardsThe number of shards of the collection. We recommend that you set the value of this parameter to an integer multiple of the number of the LindormSearch nodes in your Lindorm instance. For example, if the Lindorm instance contains two LindormSearch nodes, you can set the value of the numShards parameter to 2 or 4. The value of the numShards parameter must be smaller than the value of the MaxShardsPerNode parameter.
    replicationFactorThe number of replicas of each shard of the collection. Default value: 1.
    maxShardsPerNodeThe maximum number of shards on each node. Default value: 1.
    Note The values that you specify for the corresponding parameters must meet following condition: Value of maxShardsPerNode × Number of nodes ≥ Value of numShards × Value of replicationFactor. Otherwise, the system fails to create the collection.
    autoAddReplicaSpecifies whether to restore shards on other node when the node on which specific shards reside becomes unavailable. We recommend that you set this parameter to True.
  4. Click Add Collection.

Write data

  1. In the left-side navigation pane, select the name of the collection that is created from the Collection Selector drop-down list.
  2. Click Documents.
  3. Select CSV from the Document Type drop-down list.
  4. On the page that appears, enter the following code in the Document(s) field.
    id,update_version_l,name_s,age_i
    1,1,zhangsan,10
    2,2,lisi,20
    3,3,wangwu,30
    写入数据
    Note The preceding sample code is used to write three rows of data. Each row includes four columns. The id column and update_version_l column are required because they are system-defined columns. The suffix _s of name_s indicates that the column is of the STRING data type, and the suffix _i of age_i indicates that the column is of the INTEGER data type.
  5. Click Submit Document.

Query data

  1. In the left-side navigation pane, click Query.
  2. Enter conditions in the q field.
  3. Click Execute Query. The following figure shows the query result.
    Query data

Delete a collection

  1. In the left-side navigation pane, click Collections.
  2. Select the name of the collection that you want to delete and click Delete.
  3. Enter the name of the collection that you want to delete in the Collection field.
    Delete a collection
  4. Click Delete.