使用Shell创建 Elasticsearch 索引库 order_index 并设置分片
使用以下命令在Shell中创建名为 order_index 的索引库并设置2个分片:
curl -XPUT 'localhost:9200/order_index?pretty' -H 'Content-Type: application/json' -d'
{
"settings": {
"number_of_shards": 2
}
}
'
解释:
curl: 一个命令行工具,用于与服务器进行数据交换-XPUT: 使用PUT请求创建索引库'localhost:9200/order_index?pretty': Elasticsearch服务器的URL和索引库名称(order_index),?pretty参数表示返回的结果将被格式化以便于阅读-H 'Content-Type: application/json': 声明请求的内容类型为JSON-d'...': 请求的内容,包括设置number_of_shards为2
以上命令将创建一个名为 order_index 的索引库,并将其分为2个分片。
AI 优化版
原文地址:https://www.cveoy.top/t/topic/ofOm 著作权归作者所有。请勿转载和采集!