I would like to know why this code runs but doesn't filter the data as it should. The same request in postman works but in Kotlin it doesn't what is happening? The goal is to filter the data by timestamp value.
val getFiltered = restTemplate.exchange(
"https://X.X.X.X:6200/ble_flow-$da/_search/?size=50&pretty=1",
HttpMethod.GET, HttpEntity("{\\r\\n\\\"query\\\": { \\r\\n \\\"bool\\\": { \\r\\n \\\"filter\\\": [ \\r\\n { \\\"range\\\": { \\\"timestamp\\\": { \\\"gte\\\": \\\"2019-08-12T06:00:00\\\",\\\"lt\\\":\\\"2019-08-12T011:00:00\\\"}}} \\r\\n ]\\r\\n }\\r\\n }\\r\\n}", headers),
ResultsFlow::class.java)
println(getFiltered)
It would solve the problem if I could transform the body:
{
"query": {
"bool": {
"filter": [
{ "range": { "timestamp": { "gte": "2019-08-12T06:00:00","lt":"2019-08-12T07:00:00"}}}
]
}
}
}
into url query. But I don' really know how to do this. Thanks.