Elasticsearch索引相当于mysql中的一个库,7.0以前一个索引可以有多个表,在7.0以后就只能一个表。
索引名称不能有大写字母。
使用REST PUT命令直接创建索引,有以下几种方式(以创建索引poi为例):
创建索引,不指定分片和副本信息
PUT /poi创建索引并指定分片和副本信息
PUT /poi
{
"settings": {
"index":{
"number_of_shards":3,
"number_of_replicas":0
}
}
}说明
number_of_shards:分片数量number_of_replicas:副本数量
创建索引并指定分词器
PUT /poi
{
"settings": {
"index":{
"number_of_shards":3,
"number_of_replicas":0
}
},
"analysis":{
"analyzer":{
"ik":{
"tokenizer":"ik_max_word"
}
}
}
}GET /_cat/indices/*?v&s=indexGET /poiGET /poi/_settingsGET /_all/_settingsDELETE /poi