Convert a field datatype to object or nested in logstash

It is just like collect_set query in hive. I want to group by on one field and want to get array of unique values from other field.
Below is the JSON I got from elasticsearch after performing group by on 2 fields, city and hotels. Instead of that I want to group by on city and get distinct hotel names as array.

{ "key" : "Mumbai",
"doc_count" : 31348,
"hotels in mumbai" : {
"doc_count_error_upper_bound" : 0,
"sum_other_doc_count" : 250,
"buckets" : [ {
"key" : "The Lalit",
"doc_count" : 20927
}, {
"key" : "Three Star",
"doc_count" : 5421
}, {
"key" : "Holiday Inn",
"doc_count" : 2295
}]
}
}