【ES】创建索引

通过 Elasticsearch 的 RESTFul API 来创建索引:

PUT http://{host}:9200/{index}

默认情况下,创建的索引分片数量是 5 个,副本数量是 1 个。

如果要指定分片数、副本数量:

{
	"settings": {
		"number_of_shards": 3,
		"number_of_replicas": 2
	}
}

使用CURL命令
curl -X PUT "localhost:9200/es_index_20230801?pretty"

参考:https://www.exception.site/elasticsearch/elasticsearch-create-index

posted @ 2023-08-05 15:36  aaacarrot  阅读(197)  评论(0编辑  收藏  举报