# Java High level client Api Date range

**URL:** <https://discuss.elastic.co/t/java-high-level-client-api-date-range/173472>\
**Category:** Elasticsearch\
**Created:** [March 22, 2019, 10:05am UTC](https://discuss.elastic.co/t/java-high-level-client-api-date-range/173472 "2019-03-22T10:05:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dv\_Thiyanesh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dv_thiyanesh/32/53965_2.png) [@Dv\_Thiyanesh](https://discuss.elastic.co/u/Dv_Thiyanesh)\
**Post date:** [March 22, 2019, 10:05am UTC](https://discuss.elastic.co/t/java-high-level-client-api-date-range/173472/1 "2019-03-22T10:05:05Z")

</div>

I using java High level client Api  
In that i using range query method to fetch date range data in that i need to normal machine time as input and it need to convert it to json date to fetch data for that what i need to do?

````auto
   	 searchRequest.indices("winlogbeat-6.5.3-2019.03.18");
   	 SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder(); 
   	 searchSourceBuilder.query(QueryBuilders.rangeQuery("@timestamp").from("2019-03-18T07:00:04.874Z").to("2019-03-18T09:52:04.641Z")); 
   	 searchRequest.source(searchSourceBuilder); 
   	 SearchResponse response = client.search(searchRequest, RequestOptions.DEFAULT);```
````

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 22, 2019, 11:02am UTC](https://discuss.elastic.co/t/java-high-level-client-api-date-range/173472/2 "2019-03-22T11:02:11Z")

</div>

I'm not sure I understand the question. Do you have a full example?  
Using a pure Kibana Dev Console script would be ideal as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 19, 2019, 11:02am UTC](https://discuss.elastic.co/t/java-high-level-client-api-date-range/173472/3 "2019-04-19T11:02:14Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
