测试分词器
PUT test
GET test/_analyze
{
"analyzer": "ik_smart",
"text":"洪荒之力"
}
#返回
{
"tokens": [
{
"token": "洪荒",
"start_offset": 0,
"end_offset": 2,
"type": "CN_WORD",
"position": 0
},
{
"token": "之力",
"start_offset": 2,
"end_offset": 4,
"type": "CN_WORD",
"position": 1
}
]
}
#新建指定分片数量与副本数量的索引
PUT new_blog
{
"settings": {
"number_of_shards": 3,
"number_of_replicas": 0
}
}
#返回
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "new_blog"
}
#更新副本数量,分片数量一经指定就不可再修改
PUT new_blog/_settings
{
"number_of_replicas": 2
}
#返回
{
"acknowledged": true
}
"blocks.read_only": true #设置当前索引只允许读不允许写或者更新
"blocks.read": true#禁止对当前索引进行读操作
"blocks.write": true#禁止对当前索引进行写操作
#查看索引的所有配置信息
GET new_blog/_settings
#同时查看多个索引的所有配置信息
GET new_blog,blog/_settings
#查看集群中所有索引的配置信息
GET _all/_settings
#删除索引
DELETE new_blog
#关闭索引
POST blog/_close
#打开索引
POST blog/_open
#同时关闭多个索引
POST blog1,blog2,blog3/_close
#同时打开多个索引
POST blog1,blog2,blog3/_open
#如果集群中不存在开启/关闭请求中的全部索引,将会抛出索引不存在异常,此时可以通过ignore_unavailable=true参数操作只存在的索引
POST blog,test,zb/_close?ignore_unavailable=true
#关闭所有索引
POST _all/_close
#关闭以test开头的索引
POST test*/_close