I want to create a request that transmits me all the documents for last 15min. My XPUT document looks like this:
curl -XPUT localhost:9200/indexname/documentname/4 -d'
{
"user": "sergey",
"onlineUserCount": "43"
}'
I've searched like this:
$ curl -XGET localhost:9200/indexname/documentname/_query -d'{
"query":{
"range":{
"timestamp":{
"gt": "now -15m"
}
}
}}'
But It gave me
{"_index":"indexname","_type":"documentname","_id":"_query","found":false}
Help please!!!
You need to use the
_search
endpoint instead of the_query
endpoint and it's more advisable to use -XPOST when sending a query in the HTTP request body.