您可以使用搜索索引配置文件来指定创建Atlas Search索引或使用Atlas CLI更新Atlas Search索引时所需的设置。 Atlas CLI接受.json搜索索引配置文件。
可用设置
When you create an Atlas Search index using a configuration file, you can specify any settings that are listed in Create One Atlas Search Index under Request Body Schema.
When you update an Atlas Search index using a configuration file, you can specify any settings that are listed in Update One Atlas Search Index under Request Body Schema.
创建配置文件
创建 Atlas Search 索引
请按照以下步骤使用配置文件创建 Atlas Search 索引:
复制创建一个Atlas搜索索引的示例请求。
导航到 Atlas Admin API 规范的创建一个 Atlas Search 索引部分。
在右侧的Request samples下,单击Expand all 。
单击Copy ,复制样本请求。
使用 --file 选项运行Atlas clusters 搜索 nodes create命令。
使用--file标志指定保存的文件的路径。
更新 Atlas Search 索引
请按照以下步骤使用配置文件更新 Atlas Search 索引:
复制 Update One Atlas Search Index 的示例请求。
导航到 Atlas Admin API 规范的Update One Atlas Search Index (更新一个 Atlas 搜索索引)部分。
在右侧的Request samples下,单击Expand all 。
单击Copy ,复制样本请求。
使用--file选项运行Atlas clusters 搜索 Nodes 更新命令。
使用--file标志指定保存的文件的路径。