查看集群状态
接口url:http://xxxx:9200/_cat
查看所有索引
http://xxxx:9200/_cat/indices?v
创建索引
http://xxxx:9200/test-20230526?pretty
返回值
{
"acknowledged": true,
"shards_acknowledged": true,
"index": "test-20230526"
}
查询数据
http://xxxx:9200/seatunnel-20230526/_search?q=*&pretty
批量新增
http://xxxx:9200/_bulk
类型:POST
Header:Content-Type = application/json
请求参数:
{ "index" :{"_index":"seatunnel-20230526","_type": "testindex"}}
{"A":"","B":"INFO","task_id":"21","server_id":"1008","log_time":"2022-11-02T16:31:29","ds":"20211229","QWQE":null,"affect_data":"q"}
{ "index" :{"_index":"seatunnel-20230526","_type": "testindex"}}
{"A":"","B":"INFO","task_id":"1:21","server_id":"1008","log_time":"2021-12-29T16:34:52","ds":"20211229","QWQE":null,"affect_data":null}
由于测试用的是elasticsearch6所以必须指定_type
注意:
- 5.x及以前版本一个index有一个或者多个type
- 6.X版本一个index只有一个index
- 7.X版本移除了type,type相关的所有内容全部变成Deprecated,为了兼容升级和过渡,所有的7.X版本es数据写入后type字段都默认被置为_doc
- 8.X版本完全废弃type