# Buckets\_path parameter percents not accepting a double value

**URL:** <https://discuss.elastic.co/t/buckets-path-parameter-percents-not-accepting-a-double-value/125798>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [March 27, 2018, 6:20pm UTC](https://discuss.elastic.co/t/buckets-path-parameter-percents-not-accepting-a-double-value/125798 "2018-03-27T18:20:52Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![saii](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@saii](https://discuss.elastic.co/u/saii)\
**Post date:** [March 27, 2018, 6:20pm UTC](https://discuss.elastic.co/t/buckets-path-parameter-percents-not-accepting-a-double-value/125798/1 "2018-03-27T18:20:52Z")

</div>

I have written a watch program which uses percentile to calculate the 90th percentile of the aggregated data and when plotted against threshold,it should alert if its crossing the threshold. The percents parameter contains [90.0] in the array..But, am getting an error while executing the watch.

error: Failed to execute watch input

reason: "SearchPhaseExecutionExeception [all shards failed]; nested : [Parameter [percents] must be an array of doubles, type ArrayList provided instead]; nested : ParseException[Parameter[percents] must be an array of doubles, type ArrayList provided instead]

![image](https://us1.discourse-cdn.com/elastic/original/3X/6/1/61402d7583305b0216fd1cf62e5b8d7caddf078b.png)

I have written 90.0 but when I view the watch code after creating the watch,it shows 90 in the array. Is this what the error is specifying saying it must be double, but found ArrayList..How should I overcome this..Please help me out..

GET \_cat/shards  
[https://discuss.elastic.co/uploads/short-url/s6osJFdDONFANcEpcAAa612DgOQ.png](https://discuss.elastic.co/uploads/short-url/s6osJFdDONFANcEpcAAa612DgOQ.png)

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 28, 2018, 12:04pm UTC](https://discuss.elastic.co/t/buckets-path-parameter-percents-not-accepting-a-double-value/125798/2 "2018-03-28T12:04:01Z")

</div>

can you share the **full** watch please?

---

<div class="post-metadata">

**Author:** ![saii](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@saii](https://discuss.elastic.co/u/saii)\
**Post date:** [March 28, 2018, 1:19pm UTC](https://discuss.elastic.co/t/buckets-path-parameter-percents-not-accepting-a-double-value/125798/3 "2018-03-28T13:19:06Z")

</div>

I am also getting another exception as shown in the following scrrenshot

![image](https://us1.discourse-cdn.com/elastic/original/3X/5/9/5979e9f535d7e072f0e08d4a42c7ba8262379187.png)

How to overcome this?

The following is the complete watch ..Please help me out..

PUT \_watcher/watch/atlas  
{  
"trigger":{  
"schedule":{  
"hourly" : { "minute" : 0 }  
}  
},  
"input":{  
"search":{  
"request":{  
"indices":"data",  
"types": "data",  
"body":{  
"query":{  
"filtered":{  
"filter":{  
"range":{  
"hour":{  
"gte":"now-24h"  
}  
}  
}  
}  
},  
"size":0,  
"aggs":{  
"metrics":{  
"terms":{  
"field":"metric"  
},  
"aggs":{  
"queries":{  
"terms":{  
"field":"query"  
},  
"aggs":{  
"series":{  
"date\_histogram":{  
"field":"hour",  
"interval":"hour"  
},  
"aggs":{  
"avg":{  
"avg":{  
"field":"value"  
}  
},  
"movavg":{  
"moving\_avg":{  
"buckets\_path":"avg",  
"window":24,  
"model":"simple"  
}  
},  
"surprise":{  
"bucket\_script":{  
"buckets\_path":{  
"avg":"avg",  
"movavg":"movavg"  
},  
"script":"(avg - movavg).abs()"  
}  
}  
}  
},  
"largest\_surprise":{  
"max\_bucket":{  
"buckets\_path":"series.surprise"  
}  
}  
}  
},  
"ninetieth\_surprise":{  
"percentiles\_bucket":{  
"buckets\_path":"queries\>largest\_surprise",  
"percents":[  
90.0  
]  
}  
}  
}  
}  
}  
}  
},  
"extract":[  
"aggregations.metrics.buckets.ninetieth\_surprise",  
"aggregations.metrics.buckets.key"  
]  
}  
},  
"actions":{  
"index\_payload":{  
"transform":{  
"script": {  
"file": "hourly"  
}  
},  
"index" : {  
"index" : "atlas",  
"doc\_type" : "data"  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 28, 2018, 1:33pm UTC](https://discuss.elastic.co/t/buckets-path-parameter-percents-not-accepting-a-double-value/125798/4 "2018-03-28T13:33:56Z")

</div>

please do **not** use screenshots. It makes it unnecessarily hard to read. Also, please take your time to properly format messages and code snippets. You can use markdown in here and it is not hard to use. See the [commonmark documentation](http://commonmark.org/) if you need to know more.

The watch actually runs fine up until the index action. This also means execution of your search has worked and there was no error. We could check this out, if you had pasted the **full** output of the watch history entry or the execute watch output, whatever the snippet is from. Please take the time to provide full, properly formatted outputs, it makes debugging an issue **infinitely** easier.

Is it possible that your transform script does not return anything?

---

<div class="post-metadata">

**Author:** ![saii](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@saii](https://discuss.elastic.co/u/saii)\
**Post date:** [March 28, 2018, 1:49pm UTC](https://discuss.elastic.co/t/buckets-path-parameter-percents-not-accepting-a-double-value/125798/5 "2018-03-28T13:49:15Z")

</div>

It should definitely return a value..I will post the formatted code..

---

<div class="post-metadata">

**Author:** ![saii](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@saii](https://discuss.elastic.co/u/saii)\
**Post date:** [March 28, 2018, 2:26pm UTC](https://discuss.elastic.co/t/buckets-path-parameter-percents-not-accepting-a-double-value/125798/6 "2018-03-28T14:26:01Z")

</div>

The watch program is as follows

```
  PUT _watcher/watch/atlas
   {
      "trigger":{
             "schedule":{
             "hourly" : { "minute" : 0 }
               }
          },
   "input":{
  "search":{
     "request":{
        "indices":"data",
        "types": "data",
         "body":{
           "query":{
              "filtered":{
                 "filter":{
                    "range":{
                       "hour":{
                          "gte":"now-24h"  
                         }
                    }
                 }
              }
           },
           "size":0,
           "aggs":{
              "metrics":{
                    "terms":{
                    "field":"metric"
                   },
                  "aggs":{
                    "queries":{
                       "terms":{
                          "field":"query"
                       },
                      "aggs":{
                          "series":{
                             "date_histogram":{
                                "field":"hour",
                                "interval":"hour"
                             },
                           "aggs":{
                                "avg":{
                                   "avg":{
                                      "field":"value"
                                   }
                                },
                                "movavg":{
                                   "moving_avg":{
                                      "buckets_path":"avg",
                                      "window":24,
                                      "model":"simple"
                                   }
                                },
                            "surprise":{
                                   "bucket_script":{
                                      "buckets_path":{
                                         "avg":"avg",
                                         "movavg":"movavg"
                                      },
                                      "script":"(avg - movavg).abs()"
                                   }
                                }
                             }
                          },
                          "largest_surprise":{
                             "max_bucket":{
                                "buckets_path":"series.surprise"
                             }
                          }
                       }
                    },
                    "ninetieth_surprise":{
                       "percentiles_bucket":{
                          "buckets_path":"queries>largest_surprise",
                          "percents":[
                             90.0
                          ]
                       }
                    }
                 }
              }
           }
        }
     },
     "extract":[
       "aggregations.metrics.buckets.ninetieth_surprise",
       "aggregations.metrics.buckets.key"
    ]
  }
} },

"actions":{
  "index_payload":{
     "transform":{
        "script": {
            "file": "hourly"
        }
     },
     "index" : {
          "index" : "atlas",
          "doc_type" : "data"
        }
  } } }
```

---

<div class="post-metadata">

**Author:** ![saii](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@saii](https://discuss.elastic.co/u/saii)\
**Post date:** [March 28, 2018, 2:32pm UTC](https://discuss.elastic.co/t/buckets-path-parameter-percents-not-accepting-a-double-value/125798/7 "2018-03-28T14:32:57Z")

</div>

I am unable to paste the complete watch output as am working on two different systems..  
but the exception that I got is

status:failure  
reason: AcceptRequestValidationException[ValidationFailed: 1: no requests added;]

Everything worked well except for the actions part in the watch..Please help

---

<div class="post-metadata">

**Author:** ![saii](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@saii](https://discuss.elastic.co/u/saii)\
**Post date:** [March 28, 2018, 4:20pm UTC](https://discuss.elastic.co/t/buckets-path-parameter-percents-not-accepting-a-double-value/125798/8 "2018-03-28T16:20:38Z")

</div>

```
 {
 "_id": "atlas_0-2018-03-27T03:48:53.016Z",
 "watch_record": {
"watch_id": "atlas",
"state": "executed",
"trigger_event": {
  "type": "manual",
  "triggered_time": "2018-03-27T03:48:53.016Z",
  "manual": {
    "schedule": {
      "scheduled_time": "2018-03-27T03:48:53.016Z"
    }
  }
},
 "input": {
  "search": {
    "request": {
      "search_type": "query_then_fetch",
      "indices": [
        "data1"
      ],
      "types": [
        "data"
      ],
      "body": {
        "query": {
          "filtered": {
              "filter": {
                 "range": {
                   "hour": {
                    "gte": "now-24h"
                }
              }
            }
          }
        },
        "size": 0,
        "aggs": {
          "metrics": {
            "terms": {
              "field": "metric"
            },
             "aggs": {
              "queries": {
                "terms": {
                  "field": "query"
                },
                "aggs": {
                  "series": {
                    "date_histogram": {
                      "field": "hour",
                      "interval": "hour"
                    },
                    "aggs": {
                      "avg": {
                        "avg": {
                          "field": "value"
                        }
                      },
                      "movavg": {
                        "moving_avg": {
                          "buckets_path": "avg",
                          "window": 24,
                          "model": "simple"
                        }
                      },
                      "surprise": {
                        "bucket_script": {
                          "buckets_path": {
                            "avg": "avg",
                            "movavg": "movavg"
                          },
                          "script": "(avg - movavg).abs()"
                        }
                      }
                    }
                  },
                  "largest_surprise": {
                    "max_bucket": {
                      "buckets_path": "series.surprise"
                    }
                  }
                }
              },
              "ninetieth_surprise": {
                "percentiles_bucket": {
                  "buckets_path": "queries>largest_surprise",
                  "percents": [
                    90.01
                  ]
                }
              }
            }
          }
        }
      }
    },
    "extract": [
      "aggregations.metrics.buckets.ninetieth_surprise",
      "aggregations.metrics.buckets.key"
    ]
  }
},
"condition": {
  "always": {

  }
      },
"messages": [

],
"result": {
  "execution_time": "2018-03-27T03:48:53.016Z",
  "execution_duration": 71,
  "input": {
    "type": "search",
    "status": "success",
    "payload": {
      "aggregations": {
        "metrics": {
          "buckets": [

          ]
        }
      }
    },
    "search": {
      "request": {
        "search_type": "query_and_fetch",
        "indices": [
          "data1"
        ],
        "types": [
          "data"
        ],
        "template": {
          "template": {
            "query": {
              "filtered": {
                "filter": {
                  "range": {
                    "hour": {
                      "gte": "now-24h"
                    }
                  }
                }
              }
            },
            "size": 0,
            "aggs": {
              "metrics": {
                "terms": {
                  "field": "metric"
                },
                "aggs": {
                  "queries": {
                    "terms": {
                      "field": "query"
                    },
                    "aggs": {
                      "series": {
                                     "date_histogram": {
                          "field": "hour",
                          "interval": "hour"
                        },
                        "aggs": {
                          "avg": {
                            "avg": {
                              "field": "value"
                            }
                          },
                          "movavg": {
                            "moving_avg": {
                              "buckets_path": "avg",
                              "window": 24,
                              "model": "simple"
                            }
                          },
                          "surprise": {
                            "bucket_script": {
                              "buckets_path": {
                                "avg": "avg",
                                "movavg": "movavg"
                              },
                              "script": "(avg - movavg).abs()"
                            }
                          }
                        }
                      },
                      "largest_surprise": {
                        "max_bucket": {
                          "buckets_path": "series.surprise"
                        }
                      }
                    }
                  },
                  "ninetieth_surprise": {
                    "percentiles_bucket": {
                      "buckets_path": "queries>largest_surprise",
                      "percents": [
                        90.01
                      ]
                    }
                  }
                }
              }
            }
          },
```

---

<div class="post-metadata">

**Author:** ![saii](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@saii](https://discuss.elastic.co/u/saii)\
**Post date:** [March 28, 2018, 4:22pm UTC](https://discuss.elastic.co/t/buckets-path-parameter-percents-not-accepting-a-double-value/125798/9 "2018-03-28T16:22:05Z")

</div>

Unable to post the complete watch output.. so posting it in different messages..The following is the continuation of the above watch output which contains the exception at the end,,Kindly help..

```
"params": {
            "ctx": {
              "metadata": null,
              "watch_id": "atlas",
              "id": "atlas_0-2018-03-27T03:48:53.016Z",
              "trigger": {
                "triggered_time": "2018-03-27T03:48:53.016Z",
                                     "scheduled_time": "2018-03-27T03:48:53.016Z"
              },
              "vars": {

              },
              "execution_time": "2018-03-27T03:48:53.016Z"
            }
          }
        }
      }
    }
  },
  "condition": {
    "type": "always",
    "status": "success",
    "met": true
  },
  "actions": [
    {
      "id": "index_payload",
      "type": "index",
      "status": "failure",
      "reason": "ActionRequestValidationException[Validation Failed: 1: no requests added;]"
    }
  ]
} } }
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 25, 2018, 4:22pm UTC](https://discuss.elastic.co/t/buckets-path-parameter-percents-not-accepting-a-double-value/125798/10 "2018-04-25T16:22:12Z")

</div>

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