
参考 : 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
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)