Buckets_path parameter percents not accepting a double value

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

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

can you share the full watch please?

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

image

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"
}
}
}
}

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 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?

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

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"
        }
  }  }  }

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

 {
 "_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
                      ]
                    }
                  }
                }
              }
            }
          },

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;]"
    }
  ]
} } }

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