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
- Log on to the cluster management system provided by the search engine service that is called LindormSearch.
- In the left-side navigation pane, click Collections.
- Click Add Collection. Configure the parameters described in the following table.
Parameter Description name The name of the collection. config set The configuration set of the collection. Default value: _indexer_default. numShards The 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. replicationFactor The number of replicas of each shard of the collection. Default value: 1. maxShardsPerNode The 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.autoAddReplica Specifies 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. - Click Add Collection.
Write data
- In the left-side navigation pane, select the name of the collection that is created from the Collection Selector drop-down list.
- Click Documents.
- Select CSV from the Document Type drop-down list.
- 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. Theid
column andupdate_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. - Click Submit Document.
Query data
- In the left-side navigation pane, click Query.
- Enter conditions in the q field.
- Click Execute Query. The following figure shows the query result.
Delete a collection
- In the left-side navigation pane, click Collections.
- Select the name of the collection that you want to delete and click Delete.
- Enter the name of the collection that you want to delete in the Collection field.
- Click Delete.