Q:非洲食人族的酋长吃什么?

kibana的console里的GET语句如何转成URI形式的搜索

Elasticsearch | 作者 sailershen | 发布于2019年07月19日 | 阅读数:2591

console里的语句是:
GET /bj-sip_register/_search
{
"query": {
"range": {
"@timestamp": {
"gte": "now-4h",
"lte": "now"
}
}
}
}
输出:
{
"took" : 1,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : 1.0,
"hits" : [
{
搜索出的数据。。。

把这个搜索语句放在curl命令里:
curl -XGET 'localhost:9200//bj-sip_register/_search' -H 'Content-Type: application/json' -d'{
"query": {
"range": {
"@timestamp": {
"gte": "now-4h",
"lte": "now"
}
}
}
}'
输出结果,输出的数据量为0:
{"took":2,"timed_out":false,"_shards":{"total":15,"successful":15,"skipped":0,"failed":0},"hits":{"total":{"value":0,"relation":"eq"},"max_score":null,"hits":[]}}

不知道curl命令哪里出错了,谢谢!
已邀请:

sailershen

赞同来自:

问题解决了,使用以下命令:
curl '192.168.3.108:9200/bj-sip_register/_search?pretty' -H 'Content-Type: application/json'  -d '{
"query": {
"range": {
"@timestamp": {
"gte": "now-4h",
"lte": "now"
}
}
}
}'

输出结果:
{
"took" : 108,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 10000,
"relation" : "gte"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "bj-sip_register",
"_type" : "_doc",
"_id" : "Vjv6CWwBZw_p4NeuCBYm",
"_score" : 1.0,
"_source" : {
"register-ip" : "192.168.1.1",
"ouyu-version" : "105",
"@timestamp" : "2019-07-19T11:24:36.673Z",
"platform" : "Android",
"ouyu-number" : "444192",
"reg_time" : "2019-07-19 19:24:36",
"@version" : "1"
}
},
{
......

 
 
 

要回复问题请先登录注册