# Having a Body in a Get Request. RestTemplate

**URL:** <https://discuss.kotlinlang.org/t/having-a-body-in-a-get-request-resttemplate/13815>\
**Category:** Web Development\
**Created:** [August 9, 2019, 7:24pm UTC](https://discuss.kotlinlang.org/t/having-a-body-in-a-get-request-resttemplate/13815 "2019-08-09T19:24:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivanito111](https://avatars.discourse-cdn.com/v4/letter/i/9fc348/32.png) [@ivanito111](https://discuss.kotlinlang.org/u/ivanito111)\
**Post date:** [August 9, 2019, 7:24pm UTC](https://discuss.kotlinlang.org/t/having-a-body-in-a-get-request-resttemplate/13815/1 "2019-08-09T19:24:54Z")

</div>

Hello,

so I am making a request to elasticSearch and I want to filter the data received by Timestamp value, I want every data between 6 and 8 A.M. for example. In postman the Body → raw is something like this:

```auto
``{
"query": { 
    "bool": { 
      "filter": [ 
        { "range": { "timestamp": { "gte": "2019-08- 09T06:00:00","lt":"2019-08-09T07:00:00"}}} 
      ]
    }
  }
}
``

```

In kotlin I am trying the next piece of code but it doesn’t work. What do I have to change in order to work out? Thanks!

```auto
        val forEntity_Flow = restTemplate.exchange("https://X.X.X.X:6200/bla_bla-$da/_search/?size=50&pretty=1",
            HttpMethod.GET, HttpEntity("{\"query\":{\"bool\":{\"filter\":[{\"range\":{\"timestamp\":{\"gte\":\"2019-08-09T06:00:00\",\"lt\":\"2019-08-09T08:00:00\"}}}]}}}", headers), ResultsFlow::class.java)

```
