# Range query is not working in elasticsearch JAVA Client API

**URL:** <https://discuss.elastic.co/t/range-query-is-not-working-in-elasticsearch-java-client-api/182954>\
**Category:** Elasticsearch\
**Created:** [May 27, 2019, 6:09pm UTC](https://discuss.elastic.co/t/range-query-is-not-working-in-elasticsearch-java-client-api/182954 "2019-05-27T18:09:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yamuna\_Mallikarjun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yamuna_mallikarjun/32/46913_2.png) [@Yamuna\_Mallikarjun](https://discuss.elastic.co/u/Yamuna_Mallikarjun)\
**Post date:** [May 27, 2019, 6:09pm UTC](https://discuss.elastic.co/t/range-query-is-not-working-in-elasticsearch-java-client-api/182954/1 "2019-05-27T18:09:04Z")

</div>

Hello,

I am using ES 6.6.0 version.  
I have two indices, both the indices have the fallowing field :  
"ts": {  
"type": "date"  
}

able to query from one index and not from the other.

If i execute the below query through ES curl API then it works but it is not working when i execute the same query through java client API  
`{ "range": { "ts": { "from": 1559001262497, "to": 1559009262497, "include_lower": true, "include_upper": true, "boost": 1.0 } } }`

Please suggest what could be the reason  
Thanks  
Yamuna

---

<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:** [May 27, 2019, 7:30pm UTC](https://discuss.elastic.co/t/range-query-is-not-working-in-elasticsearch-java-client-api/182954/2 "2019-05-27T19:30:52Z")

</div>

What does your code exactly look like?

Please format your code, logs or configuration files using `</>` icon as explained in [this guide](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and not the citation button. It will make your post more readable.

Or use markdown style like:

````
```
CODE
```

````

This is the icon to use if you are not using markdown format:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/e/7e6e239431ec2d71cbf1beef741f2e93e7cc762c.jpg)

There's a live preview panel for exactly this reasons.

---

<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:** [June 24, 2019, 7:30pm UTC](https://discuss.elastic.co/t/range-query-is-not-working-in-elasticsearch-java-client-api/182954/3 "2019-06-24T19:30:57Z")

</div>

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