Watcher error - null pointer exception

I seem to have similar problem mentioned in Problem execute watcher "Cannot invoke \"Object.getClass()\" because \"callArgs[0]\" is null"

Sample JSON:

        "aggs": {
                "unique_customerid": {
                  "terms": {
                    "field": "CustomerID.keyword"
      "condition": {
        "script": {
          "source": "return > 1",
          "lang": "painless"

In Kibana logs I see that CustomerID.keyword exists so I am not sure why I get nullpointer exception here in this condition.

  "exception": {
    "type": "script_exception",
    "reason": "runtime error",
    "script_stack": [
      "return > 1",
      "                               ^---- HERE"
    "script": "return > 1",
    "lang": "painless",
    "position": {
      "offset": 31,
      "start": 0,
      "end": 78
    "caused_by": {
      "type": "null_pointer_exception",
      "reason": "Cannot invoke \"Object.getClass()\" because \"callArgs[0]\" is null",
      "stack_trace": "java.lang.NullPointerException: Cannot invoke \"Object.getClass()\" because \"callArgs[0]\" is null\n\tat 

Hi, that looks like there's a null in your aggregation payload. You can inspect the contents of ctx.payload.aggregations with Debug.explain(ctx.payload.aggregations).

In context:
Debug.explain(ctx.payload.aggregations); return > 1.

This will throw an exception with the contents of ctx.payload.aggregations, which will help us narrow down the issue.