I have a document type
doc1
{
event_timestamp:
event_type:
store_id:
}
GET /internship40/_search
{
"query":
{
"bool":
{
"must":
[
{
"match" :
{
"attributes.store_id" : "41b15888-0c2f-48f9-89d0-dc7aad19f52b"
}
},
{
"match":
{
"event_type":"app_sent_heartbeat"
}
}
]
}
},
"aggs":
{
"my_date_histo":{
"date_histogram":{
"field":"arrival_timestamp",
"interval":"day"
},
"aggs":
{
"distinct_hours": {
"cardinality": {
"script": {
"lang": "painless",
"source": "doc[params.date_field].value.hourOfDay;",
"params": {
"date_field": "arrival_timestamp"
}
}
}
},
"distinct_hours2":
{
"bucket_script":
{
"buckets_path":
{
"temp2":"distinct_hours"
},
"script":"params.temp2/24"
}
},
"cumulative_hours": {
"cumulative_sum": {
"buckets_path": "distinct_hours2"
}
}
},
"avg_daily_sales": {
"avg_bucket": {
"buckets_path": "distinct_hours2"
}
}
}
}
}
I want to run this query in dev tool (console) and show the output in dashboard. Is it possible?