This topic describes how to update a configuration set for the search engine of ApsaraDB for Lindorm (Lindorm).
Prerequisites
A shell is downloaded and installed. For more information, see Use the Apache Solr shell to connect to and use LindormSearch.
Download the default configuration set template
Download the default configuration set template _indexer_default
and modify the template to configure a custom configuration set. You can run the
following commands:
cd lindorm-search-tool/bin
./solr zk ls /configs // Query the existing configuration sets.
./solr zk downconfig -d . -n _indexer_default // Download the default configuration set template _indexer_default to the directory.
After you run the preceding commands, a directory named conf is generated in the current directory. The managed-schema
and solrconfig.xml
files exist in the conf directory.
Create a configuration set
The following steps provide an example on how to create a configuration set.
- Open the
managed-schema
file. - Define two index fields. You can run the following commands:
<field name="name" type="string" indexed="true" stored="true" required="false" multiValued="false" /> <field name="age" type="pint" indexed="true" stored="true" docValues="true" multiValued="false" />
Description:
- The
name
field is of a string data type and theage
field is of an INT data type. In the command, pint specifies the INT data type.indexed=true
specifies that you index the two fields.stored=true
specifies that you store the raw data. - If you want to create a field, define the field in the template. If you need to define
a large number of fields, you can use a dynamic field. You can use the dynamic field
that is supported by the search engine. If you want to define a dynamic field, use
dynamicField
in themanaged-schema
file. This way, you do not need to explicitly define each field in your schema. If you need to insert data into specific fields, append the dynamic field to the name of the fields into which you want to insert data. - For example, if you define a dynamic field named
*_s
, the definition of this field is automatically mapped toname_s
. If you define a dynamic field named*_i
, the definition of this field is automatically mapped toage_i
.
- The
- Upload the configuration set.
After you modify the template, you can upload your configuration set. We recommend that you use one configuration set for each collection. You can run the following command:
./solr zk upconfig -d conf/ -n myconf
- Check whether the configuration set is uploaded. You can verify the result on a web page.
In the left-side navigation pane of ClusterManager, choose Cloud > Tree and click /cnfigs. You can check whether the configuration set
myconf
is uploaded.
Suggestions
- We recommend that you use dynamicField instead of separately defining each index field.
This way, you do not need to frequently modify the
managed-schema
file. - Each index must have a unique configuration set. We recommend that you do not use one configuration set for multiple indexes.
- If you need to create a custom configuration set, download the default configuration
set template
_indexer_default
and modify the template.