我想创建一个请求,将最后15分钟的所有文件发送给我。 我的XPUT文档如下所示:
curl -XPUT localhost:9200/indexname/documentname/4 -d'
{
"user": "sergey",
"onlineUserCount": "43"
}'
我这样搜索过:
$ curl -XGET localhost:9200/indexname/documentname/_query -d'{
"query":{
"range":{
"timestamp":{
"gt": "now -15m"
}
}
}}'
但它给了我
{"_index":"indexname","_type":"documentname","_id":"_query","found":false}
请帮助!!!
答案 0 :(得分:0)
您需要使用_search
端点而不是_query
端点,在HTTP请求正文中发送查询时,建议使用-XPOST。
$ curl -XPOST localhost:9200/indexname/documentname/_search -d'{
"query":{
"range":{
"timestamp":{
"gt": "now -15m"
}
}
}}'