# How to add a Field to Range Aggregation

**URL:** <https://discuss.elastic.co/t/how-to-add-a-field-to-range-aggregation/168463>\
**Category:** Kibana\
**Created:** [February 14, 2019, 6:10pm UTC](https://discuss.elastic.co/t/how-to-add-a-field-to-range-aggregation/168463 "2019-02-14T18:10:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mariner191](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Mariner191](https://discuss.elastic.co/u/Mariner191)\
**Post date:** [February 14, 2019, 6:10pm UTC](https://discuss.elastic.co/t/how-to-add-a-field-to-range-aggregation/168463/1 "2019-02-14T18:10:11Z")

</div>

Hello,  
How to add a Field to Range Aggregation?

Thank you

 ![Elastic_Forum_Image4a_How%20to%20add%20a%20Field%20to%20Range%20Aggregation](https://us1.discourse-cdn.com/elastic/original/3X/1/b/1bbb16255f959a6b07fac23b50a93fa893e4335e.jpeg)

---

<div class="post-metadata">

**Author:** ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)\
**Post date:** [February 14, 2019, 11:01pm UTC](https://discuss.elastic.co/t/how-to-add-a-field-to-range-aggregation/168463/2 "2019-02-14T23:01:29Z")

</div>

In order to use a field there it has to mapped as number in elasticsearch. Can you share what the mappings look like for the field we want?

---

<div class="post-metadata">

**Author:** ![Mariner191](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Mariner191](https://discuss.elastic.co/u/Mariner191)\
**Post date:** [February 18, 2019, 8:39pm UTC](https://discuss.elastic.co/t/how-to-add-a-field-to-range-aggregation/168463/3 "2019-02-18T20:39:15Z")

</div>

Jon,

What specific Mapping information is needed?

The “Blue” Field is a Number

 ![](https://us1.discourse-cdn.com/elastic/original/3X/9/5/95ce83b8709b471d6ef1a4a6fe6caaa1297a9b54.jpeg)

Thanks,

-Mark

---

<div class="post-metadata">

**Author:** ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)\
**Post date:** [February 19, 2019, 4:36pm UTC](https://discuss.elastic.co/t/how-to-add-a-field-to-range-aggregation/168463/4 "2019-02-19T16:36:23Z")

</div>

Ah 🙂 Kibana thinks its a string for some reason.

We can check the elasticsearch mappings directly with

```auto
GET <index_name>/_mapping

```

in dev tools.

If it says keyword or text there we'll have to reindex the data with a numeric type. If it is a numeric type we can click the refresh icon on the index page in Kibana.

---

<div class="post-metadata">

**Author:** ![Mariner191](https://avatars.discourse-cdn.com/v4/letter/m/96bed5/32.png) [@Mariner191](https://discuss.elastic.co/u/Mariner191)\
**Post date:** [February 19, 2019, 5:34pm UTC](https://discuss.elastic.co/t/how-to-add-a-field-to-range-aggregation/168463/5 "2019-02-19T17:34:35Z")

</div>

In dev tools, does "Type" need to be set to "Float", or perhaps some other Type?

 ![Elastic_Forum_Image4c_DevTools_map%20a%20Field%20for%20Aggregation](https://us1.discourse-cdn.com/elastic/original/3X/b/f/bfd94ff8a8fc5f15e51041079704688253410991.jpeg)

---

<div class="post-metadata">

**Author:** ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)\
**Post date:** [February 19, 2019, 11:51pm UTC](https://discuss.elastic.co/t/how-to-add-a-field-to-range-aggregation/168463/6 "2019-02-19T23:51:44Z")

</div>

Yup, one of these: [https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/number.html).

If it has decimals, float or double, if not long or integer.

---

<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:** [March 20, 2019, 12:04am UTC](https://discuss.elastic.co/t/how-to-add-a-field-to-range-aggregation/168463/7 "2019-03-20T00:04:30Z")

</div>

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