Hi,
I'm trying to use a scripted metric aggregation as sub aggregation after a date histogram aggregation and I'm getting some errors: 'Cannot invoke method getAt() on null object'
If I do this same scripted metric aggregation after another type of bucket aggregation (non date histogram) then everything works.
Does anybody know why this type of query is failing after a date histogram aggregation?
script:
{
_    "query":{_
_        "bool": {_
_           "must": [_
_                {"bool": {_
_                    "should": [_
_                      {"term": {"host": "pvx9alfcl1"}},_
_                      {"term": {"host": "pvx9alfcl2"}}_
_                     ]_
_                }},_
_                {"term": {"HTTP_url": "download"}}_
_            ]_
_        }_
_     },_
_     "aggs": {_
_          "requests_over_time" : {_
_             "date_histogram" : {_
_                "field": "@timestamp",_
_                "interval" : "1d"_
_                       },_
_                       "aggs": {_
_                          "profit": {_
_                            "scripted_metric": {_
_                                "init_script" : {_
_                                    "file": "script_init_01",
_                                    "lang": "groovy"_
_                                },_
_                                "map_script" : {_
_                                    "file": "script_map_01",
_                                    "lang": "groovy"_
_                                },_
_                                "combine_script" : {_
_                                    "file": "script_combine_01",
_                                    "lang": "groovy"_
_                                },_
_                                "reduce_script" : {_
_                                     "file": "script_reduce_01",
_                                     "lang": "groovy"_
_                                }_
_                            }_
_                        }_
_                       }_
_                   }_
_      }_
}
regards,
Michel