# Filter constructed with Java API

**URL:** <https://discuss.elastic.co/t/filter-constructed-with-java-api/39572>\
**Category:** Elasticsearch\
**Created:** [January 19, 2016, 5:22pm UTC](https://discuss.elastic.co/t/filter-constructed-with-java-api/39572 "2016-01-19T17:22:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cterron](https://avatars.discourse-cdn.com/v4/letter/c/ccd318/32.png) [@cterron](https://discuss.elastic.co/u/cterron)\
**Post date:** [January 19, 2016, 5:22pm UTC](https://discuss.elastic.co/t/filter-constructed-with-java-api/39572/1 "2016-01-19T17:22:40Z")

</div>

I'm constructing a filter use the Java API to put in a warmer query. The filter is  
`{ "filtered" : { "filter" : { "and" : { "filters" : [{ "range" : { "message.timestamp_occured" : { "from" : 1452902400000, "to" : 1452988799999, "include_lower" : true, "include_upper" : true }, "_cache" : true } }, { "term" : { "message.suppressed" : "false" } }] } } } }`  
Is it this filter equivalent to the next one, specially at cache level?  
{  
"filtered" : {  
"filter" : {  
"and" : {  
"filters" : [ {  
"range" : {  
"message.timestamp\_occured" : {  
"gte" : 1452902400000,  
"lte" : 1452988799999  
},  
"\_cache" : true  
}  
}, {  
"term" : {  
"message.suppressed" : "false"  
}  
} ]  
}  
}  
}  
}

I don't know if a warmer using the second query will catch the first query.

---

<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:** [July 5, 2017, 11:23pm UTC](https://discuss.elastic.co/t/filter-constructed-with-java-api/39572/2 "2017-07-05T23:23:21Z")

</div>

Closed on July 5, 2017, 11:23pm UTC


