Elasticsearch 5.5.2 Matrix Stats Aggregation on Date histogram

I am trying to use Matrix Stats aggregation to get the skew and kurtosis of a date histogram. Its the possible?

My knowledge of nesting aggs together is very basic. I've tried to do this query but it does not work. Is there a way I can format the date histogram agg to pass it to the matrix stats histogram or a better/easier way to do what I'm trying?

curl -XPOST 'localhost:9200/wos/_search?size=0&pretty' -H 'Content-Type: application/json' -d'
> {
> "query": {
>       "bool": {
>         "must": 
>           { "match": { "_all": "Supercapacitor" } }
>         ,
>         "filter": 
>           { "range" : {
>               "date" : {
>                 "gte" : "now-15y",
>                 "lt" :  "now"
>               }
>             }
>           }
>         }
>     },
>     "aggs": {
>         "matrixstats": {
>             "matrix_stats": {
>                 "aggs" : {
>                   fields: [
>                     "aggs" : {
>                         "papers_over_time" : {
>                             "date_histogram" : {
>                                 "field" : "date",
>                                 "interval" : "year"
>                             }
>                         }
>                     }
>                   ]
>                 }
>             }
>         }
>     }
>     
> }
> '
{
  "error" : {
    "root_cause" : [
      {
        "type" : "parsing_exception",
        "reason" : "Unexpected token START_OBJECT [aggs] in [matrixstats].",
        "line" : 21,
        "col" : 26
      }
    ],
    "type" : "parsing_exception",
    "reason" : "Unexpected token START_OBJECT [aggs] in [matrixstats].",
    "line" : 21,
    "col" : 26
  },
  "status" : 400
}

Thanks in advance,

Alex

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