健康类的api
集群文档数量
curl -XGET 'http://localhost:9200/_count?pretty' -d ' { "query": { "match_all": {} } } '
像上面这种请求你可以用curl,但我不是很习惯,我更习惯用jmeter去访问。
健康检测
/_cat/health?v
最重要的就是 status了,green代表健康,yellow代表亚健康,red代表岌岌可危,要赶快处理了
节点检测
/_cat/notes?v
查看索引
/_cat/indices?v
啥都看不到,是因为我们还没有索引。
增删改查api
PUT /customer #添加索引 PUT /customer/external/1 #添加document { "name": "John Doe" } GET /customer/external/1 #获取document DELETE /customer #删除索引
添加文档时,如果不传具体的id用post进行提交。
Elasticsearch RESTful API 指南
本文介绍了如何使用Elasticsearch的RESTful API进行健康检查、节点检测和索引操作。通过/_cat/health获取集群健康状态,status为green、yellow、red分别代表健康、亚健康和危险。/_cat/nodes用于查看节点信息,/_cat/indices用于查看索引。还提到了如何使用POST方法添加文档。
554

被折叠的 条评论
为什么被折叠?



