# Weird mappings to index for array of numeric ranges

**URL:** <https://discuss.elastic.co/t/weird-mappings-to-index-for-array-of-numeric-ranges/119249>\
**Category:** Elasticsearch\
**Created:** [February 9, 2018, 2:03pm UTC](https://discuss.elastic.co/t/weird-mappings-to-index-for-array-of-numeric-ranges/119249 "2018-02-09T14:03:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mukolajko25](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mukolajko25/32/17191_2.png) [@Mukolajko25](https://discuss.elastic.co/u/Mukolajko25)\
**Post date:** [February 9, 2018, 2:03pm UTC](https://discuss.elastic.co/t/weird-mappings-to-index-for-array-of-numeric-ranges/119249/1 "2018-02-09T14:03:06Z")

</div>

Hi.

I have two arrays with numbers in ranges called ageRange and householdIncomeRange.

For age range we can have values like `[null, 17], [18,24], [25,34]...[65,null]`.

For household Income we can have values like `[null, 14999], [15000, 24999], [25000, 34999], [35000, 49999], [50000, 74999]...[200000, 249999], [250000, null]`.

Now when i try to add those values into index i get very weird results in mapped fields.

For age range after aggregation i get keys like this :  
`< 17 , 18-24, 25-34, ... 65+.`

For household Income i get keys like this :  
`0 for [null, 14999], 1 for [15000, 24999], 2 for[25000, 34999] , 3, ... , 11 for [250000, null] ..`

Here is how its mapped in GET \_mapping/

`"ageRange": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }`

`householdIncomeRange": { "type": "text", "fields": { "keyword": { "type": "keyword", "ignore_above": 256 } } }`

Elastic search version 5.6

So my question is..How in the hell does it transforms ageRange into string joined by - , and household Income into numbers(what looks like to me as indexes of first elements in array).

Thank you.

---

<div class="post-metadata">

**Author:** ![Mukolajko25](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mukolajko25/32/17191_2.png) [@Mukolajko25](https://discuss.elastic.co/u/Mukolajko25)\
**Post date:** [February 9, 2018, 2:08pm UTC](https://discuss.elastic.co/t/weird-mappings-to-index-for-array-of-numeric-ranges/119249/2 "2018-02-09T14:08:12Z")

</div>

To make it even more weird. If i add to age ranges new set of values that are more than 999 for example `[1001, 1005]`.

I will get in aggregation keys like this:  
`<17, 18-24, 25,34,...65+, 1001, 1005` ?? WTF really?

Is elastic search being smart and try to map those fields on background some how with pattern?

---

<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 9, 2018, 2:08pm UTC](https://discuss.elastic.co/t/weird-mappings-to-index-for-array-of-numeric-ranges/119249/3 "2018-03-09T14:08:29Z")

</div>

Closed on March 9, 2018, 2:08pm UTC

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