Trying to figure out the best way to 'count' values for aggregating dynamic data.
For instance the 2 records below is a sampling of data where 'key' data is not static. Some records may have height:21 and width:28 while others may have input_position:20.55 and output_diameter:22.04 and so on. There is an endless number of key value pairs that could require the aggregations.
SAMPLE DATA
{
"_index" : "catalog_seats3",
"_type" : "_doc",
"_id" : "16",
"_score" : 1.3362663,
"_source" : {
"item_number" : "sy1236239",
"description" : "black cloth forklift seat with book box",
"make" : "ub40",
"attributes" : {
"height" : "21",
"width" : "28"
"options" : [
"cloth",
"seat switch",
"seat belt"
]
}
},
{
"_index" : "catalog_seats3",
"_type" : "_doc",
"_id" : "4",
"_score" : 1.2968898,
"_source" : {
"item_number" : "sy91825",
"description" : "black vinyl forklift seat",
"make" : "grammer",
"attributes" : {
"input_position" : "20.55",
"output_diameter" : "22.04"
"options" : [
"vinyl",
"seat adjusters",
"seat tilt",
"book box"
]
}
},
Ultimately I would like to have something like buckets that count like this...
height
-key:21
-count:5
-key:23.5
-count:12
width
-key:28
-count:17
-key:27.5
-count:6
input_position
-key:20.55
-count:3
-key:22
-count:15
output_diameter
-key:22.04
-count:3
-key:21
-count:16
Any help would be very much appreciated. Even if you could point me in the right direction.
Thank you