学习是一个逐步发现自己无知的过程!

es常用查询语句

查询最近7天的数据量

curl -XGET 'http://user:password@ip:9200/access.log/_count' -H 'Content-Type: application/json' -d '
{ "query": { "range": { "@timestamp": { "gte": "now-7d/d", "lte": "now/d" } } } }'

查询最新的一条数据

curl -X GET "http://user:password@ip:9200/access.log/_search?pretty=true" -H 'Content-Type: application/json' -d'
{ "query": { "match_all": {} }, "sort": [ {"@timestamp": { "order": "desc" } } ], "size": 1}'

查看index

curl  http://user:password@ip:9200/access.log

统计index中的数据总量

curl http://user:password@ip:9200/access.log/_count?pretty

删除指定的index

curl -X DELETE http://user:password@ip:9200/access.log/_count?pretty
赞(0)
未经允许不得转载:劉大帥 » es常用查询语句

你的评论可能会一针见血! 抢沙发

登录

找回密码

注册