DSL query Filter on aggregated result

Hi,
I am very new to write DSL query.

I have written DSL query now I want to filter result if search_Latency > 0.5,

Please help me to write query.
{

“size”: 0,

“query”: {

“bool”: {

“filter”: {

“range”: {

“timestamp”: {

“from”: “now-10m”,

“to”: “now”

}

}

}

}

},

“aggs”: {

“hosts”: {

“terms”: {

“field”: “source_node.name”

},

“aggs”: {

“query_time_in_millis”: {

“avg”: {

“field”: “node_stats.indices.search.query_time_in_millis”

}},

“query_total”: {

“avg”: {

“field”: “node_stats.indices.search.query_total”

}

          },
           "search_Latency": {
"bucket_script": {
  "buckets_path": {
    "my_var1": "query_time_in_millis",
    "my_var2": "query_total"
  },
  "script": "params.my_var1 / params.my_var2"
}
      }

}}}}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.