1.了解ES官网的文档,发现在跟着步骤执行时出现了问题
语法:
PUT /megacorp/employee/1
{
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
"interests": [ "sports", "music" ]
}
出现异常:
#! Deprecation: the default number of shards will change from [5] to [1] in 7.0.0; if you wish to continue using the default of [5] shards, you must manage this on the create index request or with an index template
这里描述的大概意思是,ES7.0后已经改变了之前的默认分片 从5变成1,所以你如果想创建上面的索引,需要人工去改分片数量
解决方法,我这边是直接把索引的分片改成1:
PUT /megacorp/_settings
{
"number_of_replicas": 1
}
再执行上面的新建索引命令创建成功