I am executing aggregation query in kibana discovery but it giving me error [parsing_exception] no [query] registered for [aggs],
which is working fine in dev tools.
Here is the query which i am using.
{
"aggs": {
"users": {
"terms": {
"field": "principal.keyword"
},
"aggs": {
"last_visted_date": {
"max": {
"field": "timestamp"
}
},
"activity_login": {
"filter": {
"term": {
"action.keyword": "LOGIN"
}
},
"aggs": {
"last_login_date": {
"max": {
"field": "timestamp"
}
}
}
},
"active_users": {
"bucket_selector": {
"buckets_path": {
"lastvisted": "last_visted_date",
"lastlogindate": "activity_login>last_login_date"
},
"script": "if(params.lastvisted==params.lastlogindate){return true;}else{return false;}"
}
}
}
}
}
}
Here is the error i am getting
[parsing_exception] no [query] registered for [aggs]