# Difference range query between numeric type and range type

**URL:** <https://discuss.elastic.co/t/difference-range-query-between-numeric-type-and-range-type/277527>\
**Category:** Elasticsearch\
**Created:** [July 1, 2021, 8:17am UTC](https://discuss.elastic.co/t/difference-range-query-between-numeric-type-and-range-type/277527 "2021-07-01T08:17:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kr\_junhodo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kr_junhodo/32/91048_2.png) [@kr\_junhodo](https://discuss.elastic.co/u/kr_junhodo)\
**Post date:** [July 1, 2021, 8:17am UTC](https://discuss.elastic.co/t/difference-range-query-between-numeric-type-and-range-type/277527/1 "2021-07-01T08:17:58Z")

</div>

i Think [this article](https://www.elastic.co/blog/numeric-and-date-ranges-in-elasticsearch-just-another-brick-in-the-wall) says that `range type` is better way for range query.

example 1)  
doc mapping : start\_date(date) and end\_date(date)  
query description : start\_date \< criteria && criteria \< end\_date via range query

example 2\_  
doc mapping : date (date\_range)  
query description : start\_date \< criteria && criteria \< end\_date via term query

is there any difference of performance between example1 and example2?

thanks

---

<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:** [July 1, 2021, 2:21pm UTC](https://discuss.elastic.co/t/difference-range-query-between-numeric-type-and-range-type/277527/2 "2021-07-01T14:21:17Z")

</div>

It's a different use-case, so comparing performance does not make much sense in some ways. If the second example solves your use-case I'd always go with that simplified solution. The range example is useful for hotel room reservations, employee holiday planning ("who is gone from 1st till the 31st of August") etc.

Hope this helps!

---

<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 29, 2021, 2:21pm UTC](https://discuss.elastic.co/t/difference-range-query-between-numeric-type-and-range-type/277527/3 "2021-07-29T14:21:24Z")

</div>

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