# Does insert order matter for date range queries

**URL:** <https://discuss.elastic.co/t/does-insert-order-matter-for-date-range-queries/18682>\
**Category:** Elasticsearch\
**Created:** [July 15, 2014, 3:47pm UTC](https://discuss.elastic.co/t/does-insert-order-matter-for-date-range-queries/18682 "2014-07-15T15:47:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![javadevmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javadevmtl/32/45613_2.png) [@javadevmtl](https://discuss.elastic.co/u/javadevmtl)\
**Post date:** [July 15, 2014, 3:47pm UTC](https://discuss.elastic.co/t/does-insert-order-matter-for-date-range-queries/18682/1 "2014-07-15T15:47:27Z")

</div>

Say I insert a few documents that have my own "date" field (NOT the ES  
insert stamp) but not inserted in order of that specific date field.

{  
...  
"DateMoved": "2014-12-31..."  
}

{  
...  
"DateMoved": "2013-12-31..."  
}

{  
...  
"DateMoved": "2014-12-25..."  
}

{  
...  
"DateMoved": "2012-12-25..."  
}

{  
...  
"DateMoved": "2013-12-25..."  
}

And so on...

If i wanted to do a range query by DateMoved (For all documents in 2013-12)  
would it affect the speed of the query?

I have been testing my query and seems to be running ok. But just double  
checking to see there's no caveats.

--  
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/cca69f29-b674-4505-9837-712e86ed59d2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/cca69f29-b674-4505-9837-712e86ed59d2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [July 15, 2014, 3:49pm UTC](https://discuss.elastic.co/t/does-insert-order-matter-for-date-range-queries/18682/2 "2014-07-15T15:49:28Z")

</div>

I don't believe it matters, no.

On Tue, Jul 15, 2014 at 11:47 AM, John Smith [java.dev.mtl@gmail.com](mailto:java.dev.mtl@gmail.com) wrote:

> Say I insert a few documents that have my own "date" field (NOT the ES  
> insert stamp) but not inserted in order of that specific date field.
> 
> {  
> ...  
> "DateMoved": "2014-12-31..."  
> }
> 
> {  
> ...  
> "DateMoved": "2013-12-31..."  
> }
> 
> {  
> ...  
> "DateMoved": "2014-12-25..."  
> }
> 
> {  
> ...  
> "DateMoved": "2012-12-25..."  
> }
> 
> {  
> ...  
> "DateMoved": "2013-12-25..."  
> }
> 
> And so on...
> 
> If i wanted to do a range query by DateMoved (For all documents in  
> 2013-12) would it affect the speed of the query?
> 
> I have been testing my query and seems to be running ok. But just double  
> checking to see there's no caveats.
> 
> --  
> 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/cca69f29-b674-4505-9837-712e86ed59d2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/cca69f29-b674-4505-9837-712e86ed59d2%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/cca69f29-b674-4505-9837-712e86ed59d2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/cca69f29-b674-4505-9837-712e86ed59d2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/CAPmjWd16%2BjjVCjMJJCZLqaa1E-y2k\_gfptHbC0YMwmSVXN3Ezg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAPmjWd16%2BjjVCjMJJCZLqaa1E-y2k_gfptHbC0YMwmSVXN3Ezg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![javadevmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javadevmtl/32/45613_2.png) [@javadevmtl](https://discuss.elastic.co/u/javadevmtl)\
**Post date:** [July 17, 2014, 1:37pm UTC](https://discuss.elastic.co/t/does-insert-order-matter-for-date-range-queries/18682/3 "2014-07-17T13:37:19Z")

</div>

Thanks

On Tuesday, 15 July 2014 11:49:56 UTC-4, Nikolas Everett wrote:

> I don't believe it matters, no.
> 
> On Tue, Jul 15, 2014 at 11:47 AM, John Smith \<[java.d...@gmail.com](mailto:java.d...@gmail.com)  
> \<javascript:\>\> wrote:
> 
> > Say I insert a few documents that have my own "date" field (NOT the ES  
> > insert stamp) but not inserted in order of that specific date field.
> > 
> > {  
> > ...  
> > "DateMoved": "2014-12-31..."  
> > }
> > 
> > {  
> > ...  
> > "DateMoved": "2013-12-31..."  
> > }
> > 
> > {  
> > ...  
> > "DateMoved": "2014-12-25..."  
> > }
> > 
> > {  
> > ...  
> > "DateMoved": "2012-12-25..."  
> > }
> > 
> > {  
> > ...  
> > "DateMoved": "2013-12-25..."  
> > }
> > 
> > And so on...
> > 
> > If i wanted to do a range query by DateMoved (For all documents in  
> > 2013-12) would it affect the speed of the query?
> > 
> > I have been testing my query and seems to be running ok. But just double  
> > checking to see there's no caveats.
> > 
> > --  
> > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/cca69f29-b674-4505-9837-712e86ed59d2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/cca69f29-b674-4505-9837-712e86ed59d2%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/cca69f29-b674-4505-9837-712e86ed59d2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/cca69f29-b674-4505-9837-712e86ed59d2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
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/2c764769-e24e-4134-8c2f-d88333024724%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2c764769-e24e-4134-8c2f-d88333024724%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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:15am UTC](https://discuss.elastic.co/t/does-insert-order-matter-for-date-range-queries/18682/4 "2017-07-06T01:15:12Z")

</div>


