curl 访问es 常用的命令
查询有哪些索引
curl -X GET 'http://10.0.0.143:8200/_cat/indices'
查询索引的别名
curl -XGET 'http://127.0.0.1:8200/index_v1/_alias'
根据查询语句查询数据
curl -XGET 'http://127.0.0.1:8200/bug_read/_search' -H 'Content-Type: application/json' -d '{"query": {"range": {"insert_time": {"from": "2022-05-23T00:00:00","to": "2022-05-23T12:00:00"}}},"size": 1}'
根据查询语句查询数据 要求携带keyword 关键字 es的分词问题
curl -XGET 'http://127.0.0.1:8200/bug_read/_search' -H 'Content-Type: application/json' -d '{"query": {"range": {"insert_time.keyword": {"from": "2022-05-23T00:00:00","to": "2022-05-23T12:00:00"}}},"size": 1}'
根据查询语句查询数据 查询的结果的总数即total 是eq 一个确定的值
curl -XGET 'http://127.0.0.1:8200/bug_read/_search' -H 'Content-Type: application/json' -d '{"query": {"range": {"insert_time": {"from": "2022-05-23T00:00:00","to": "2022-05-23T12:00:00"}}},"size": 1,"track_total_hits":true}'
"track_total_hits":true 这个参数要求查询的结果总数不是一个估计值