1._cat接口
| _cat接口 | 说明 |
| get /_cat/nodes | 查看所有节点 |
| get /_cat/health | 查看es健康状况 |
| get /_cat/master | 查看主节点 |
| get /_cat/indices | 查看所有索引信息 |
es 中会默认提供上面的几个索引,表头的含义为
2.索引操作
索引就相当于数据库
2.1 创建索引 put/索引名
创建索引名是test_0的索引。
默认分片shards=3,副本replicas=2.
2.2 查看索引 get /索引名
2.3 删除索引 delete /索引名称
再查看已经不存在此索引了
3.文档操作
文档相当于数据库中的表结构中的row记录。
3.1 创建
put /索引名称/类型名/编号
post /索引名称/类型名/编号
3.2 查询
get /索引/类型/id
3.3 更新
post /索引/类型/id/_update
这里提示索引是只读模式无法修改,使用api切换回来:
也可以批量设置取消只读:
admin@desktop-veamt68 mingw64 /
$ curl -xput -h "content-type: application/json" http://192.168.1.10:9200/_all/_settings -d '{"index.blocks.read_only_allow_delete": "false"}'
% total % received % xferd average speed time time time current
dload upload total spent left speed
100 69 100 21 100 48 42 96 --:--:-- --:--:-- --:--:-- 138{"acknowledged":true}
可以看到现在索引为非只读模式:
更新成功:
3.4 删除
delete /索引/类型/id
delete /索引
3.5 测试
_bulk批量操作,语法格式
{action:{metadata}}\n
{request body }\n
{action:{metadata}}\n
{request body }\n
发表评论