RAM field in Mobile specifications has lots of data which i need to apply some kind of Range filter on strings . I have formatted bucket into key value pair RAM and Doc count
"RAM": {
"1": 7,
"32": 1,
"32 MB": 490,
"1 GB": 426,
"2 GB": 361,
"3 GB": 269,
"4 GB": 143,
"512 MB": 136,
"256 MB": 87,
"10 MB": 61,
"64 MB": 47,
"1 MB": 45,
"128 MB": 41,
"56 MB": 27,
"1.5 GB": 23,
"16 MB": 12,
"35 MB": 12,
"4 MB": 11,
"0.032 MB": 10,
"100 MB": 7,
"3 MB": 7,
"2 MB": 6,
"768 MB": 6,
"40 MB": 4,
"30 MB": 3,
"6 GB": 3,
"20 MB": 2,
"46 MB": 2,
"500 MB": 2,
"60 MB": 2,
"120 MB": 1,
"131 MB": 1,
"138 MB": 1,
"153 MB": 1,
"200 MB": 1,
"24 MB": 1,
"250 MB": 1,
"260 MB": 1,
"50 MB": 1,
"55 MB": 1,
"65 MB": 1,
"8 GB": 1
}
How to convert the above one to something like below
128 MB and Below
1 GB
2 GB
3 GB
4 GB
6 GB and Above
One possible solution would be index the value of RAM as numeric datatype and apply range filter on the field. But how to differentiate 1 Mb and 1 GB .
I solved it by convert all that in the lowest unit and removed the conversion unit.
please check here
https://discuss.elastic.co/t/elasticsearch-5-5-aggs-range-filter-on-string-datatype/106400/3