Manage collections

更新时间:
复制 MD 格式

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

Terms

  • Collection: An index table.

  • Shard: A partition of a collection.

  • Replica: A copy of a shard.

Create a collection

  1. Log on to the search engine's cluster management system.

  2. In the left-side navigation pane, click Collections.

  3. Click Add Collection.

    Create a collection

    The following table describes the main parameters.

    Parameter

    Description

    name

    The name of the collection.

    config set

    The configuration set for the collection. The default value is _indexer_default.

    numShards

    The number of shards for the collection. We recommend that you set this value to a multiple of the number of nodes. For example, if the search engine has 2 nodes, you can set numShards to 2 or 4. Note the limit imposed by maxShardsPerNode.

    replicationFactor

    The number of replicas for each shard. The default value is 1.

    maxShardsPerNode

    The maximum number of shards from this collection allowed per node. The default value is 1.

    Note

    These settings must satisfy the following formula: maxShardsPerNode × number of nodes ≥ numShards × replicationFactor. Otherwise, collection creation fails.

    autoAddReplica

    Specifies whether to automatically create a replica on another node if the hosting node becomes unavailable. We recommend that you set this parameter to True.

  4. Click Add Collection in the dialog box.

Write data

  1. In the left-side navigation pane, select your collection from the Collection Selector drop-down list.

  2. Select Documents to open the data entry page.

  3. From the Document Type drop-down list, select CSV.

  4. In the Document(s) text area, enter the following data.

    id,update_version_l,name_s,age_i
    1,1,zhangsan,10
    2,2,lisi,20
    3,3,wangwu,30

    写入数据

    Note

    This example adds three rows of data, each with four columns. The id and update_version_l columns are system-defined and required. The _s suffix in name_s indicates a string type, and the _i suffix in age_i indicates an integer type.

  5. Click Submit Document.

Query data

  1. In the left-side navigation pane, click Query.

  2. In the q text box, enter your query criteria.

  3. Click Execute Query. The results are shown in the following figure.

    Query data

Delete a collection

  1. In the left-side navigation pane, click Collections.

  2. Select the collection and click Delete.

  3. In the Collection text box, enter the name of the collection.

  4. Click Delete.删除索引