{"updated_on":"2020-11-15","journal":{"2020-10-20":"a","2020-10-21":"b"}}
{"updated_on":"2020-11-14","journal":{"2020-10-21":"c","2020-10-23":"b"}}
How to form aggregation query based on “journal” hash key’s(where key’s e.g. “2020-10-20” is dynamic ) .If not possible then how to structure data to generate below output
Result should be:
{ "aggregations" : {
"journal_status_counts" : {
"buckets" : [
{
"key_as_string" : "2020-10-20",
"key" : 1603305000000,
"doc_count" : 2
},
{ "key_as_string" : "2020-10-21",
"key" : 1603305000000,
"doc_count" : 1
},
{ "key_as_string" : "2020-10-22",
"key" : 1603305000000,
"doc_count" : 0
}
,
{ "key_as_string" : "2020-10-23",
"key" : 1603305000000,
"doc_count" : 1
}
,
{ "key_as_string" : "2020-10-24",
"key" : 1603305000000,
"doc_count" : 0
}
…
]
…
}
}
}
Could you make some change?
{"updated_on":"2020-11-15","journal":[{"date":"2020-10-20","value":"a"},{"date":"2020-10-21","values":"b"}]}
Thanks Wang But I have resolved this by key as value and value as key
{"updated_on":"2020-11-15","journal":{"a":"2020-10-20","b":"2020-10-21"}}
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.