elasticsearch(6) : CURL相关命令

elasticsearch(6) : CURL相关命令,第1张

elasticsearch(6) : CURL相关命令

参考 : elasticsearch中使用curl进行的简单查询_浅谈-CSDN博客_curl查询es某个索引数据

说明
  • 查询多个index可以前缀加*号,如 test_index*
查看所有索引
curl http://127.0.0.1:9200/_cat/indices?v
查看单个索引信息
curl -XGET http://127.0.0.1:9200/test_index?pretty
精确查询
curl -H "Content-Type:application/json" -XGET http://127.0.0.1:9200/test_index/_search?pretty -d  
'{
    "query": {
        "bool": {
            "must": [{
                "term": {
                    "timestamp": "1639140845491"
                }
            }]
        }
    }
}'
查询两条数据
curl -H "Content-Type:application/json" -XGET http://127.0.0.1:9200/test_index/_search?pretty -d 
'
{
    "query":{
        "match_all":{

        }
    },
    "size":2
}
'
范围查询
curl -H "Content-Type:application/json" -XGET http://127.0.0.1:9200/test_index/_search?pretty -d 
'
{
    "query":{
        "range":{
            "timestamp":{
                "gte": "1639140843491",
                "lte": "1639140846491"
            }
        }
    }
}
'
删除索引
curl -XDELETE http://127.0.0.1:9200/test_index

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5669137.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存