# Range query problems

**URL:** <https://discuss.elastic.co/t/range-query-problems/15039>\
**Category:** Elasticsearch\
**Created:** [December 27, 2013, 10:26pm UTC](https://discuss.elastic.co/t/range-query-problems/15039 "2013-12-27T22:26:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![silvina](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/silvina/32/44096_2.png) [@silvina](https://discuss.elastic.co/u/silvina)\
**Post date:** [December 27, 2013, 10:26pm UTC](https://discuss.elastic.co/t/range-query-problems/15039/1 "2013-12-27T22:26:29Z")

</div>

Hi,  
I want to retrive the last two days of a seller\_id, the query is:  
{  
"from": 0,  
"size": 50,  
"query": {  
"term": {  
"seller.id": 4  
}  
},  
"filter": {

```
      "range": {
        "date_created": {
          "from": "now/d-1d",
          "to": "now",
          "include_lower": false,
          "include_upper": true
        }
      }

```

}  
}

The query return two days: yesterday and two day ago. We had elastic 0.90.3  
version and it was working but then we changed to elastic 0.90.8 version  
and it didn't work. I don't know if the problem is related to elastic's  
version. Any idea about that?

Thanks.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0e5291f3-8995-4889-8de9-1d3af257cdb3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0e5291f3-8995-4889-8de9-1d3af257cdb3%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [January 1, 2014, 7:30pm UTC](https://discuss.elastic.co/t/range-query-problems/15039/2 "2014-01-01T19:30:46Z")

</div>

Hey,

can you provide an example as mentioned in [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://elasticsearch.org/help) -  
so one can reproduce your problem on elasticsearch 0.90.8?

In addition you should try using a filtered query, with a match\_all query  
and a bool filter, which contains a term filter and a range filter. See

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

--Alex

On Fri, Dec 27, 2013 at 11:26 PM, anivlis [svlucero@gmail.com](mailto:svlucero@gmail.com) wrote:

> Hi,  
> I want to retrive the last two days of a seller\_id, the query is:  
> {  
> "from": 0,  
> "size": 50,  
> "query": {  
> "term": {  
> "seller.id": 4  
> }  
> },  
> "filter": {
> 
> ```
> "range": {
> "date_created": {
> "from": "now/d-1d",
> "to": "now",
> "include_lower": false,
> "include_upper": true
> }
> }
> 
> ```
> 
> }  
> }
> 
> The query return two days: yesterday and two day ago. We had elastic  
> 0.90.3 version and it was working but then we changed to elastic 0.90.8  
> version and it didn't work. I don't know if the problem is related to  
> elastic's version. Any idea about that?
> 
> Thanks.
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/0e5291f3-8995-4889-8de9-1d3af257cdb3%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0e5291f3-8995-4889-8de9-1d3af257cdb3%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGCwEM8i8j4Bd8hWg-GMm80bNwtL4Oa4pwkURxfZ8AcUQEd8\_w%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGCwEM8i8j4Bd8hWg-GMm80bNwtL4Oa4pwkURxfZ8AcUQEd8_w%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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 6, 2017, 1:58am UTC](https://discuss.elastic.co/t/range-query-problems/15039/3 "2017-07-06T01:58:48Z")

</div>


