Simple date histogram?

前端 未结 2 713
逝去的感伤
逝去的感伤 2021-01-27 09:34

Viewing documents on per weekday classification? My data is in a format like this:

{\"text\": \"hi\",\"created_at\": \"2016-02-21T18:30:36.000Z\"}
2条回答
  •  一向
    一向 (楼主)
    2021-01-27 10:04

    To use a script in an aggregation the script value is not a string but another object. I think you also need to specify lang alongside file.

    "aggs": {
        "byDays": {
            "terms": {
                "script": {
                    "lang": "groovy",
                    "file": "dateConversion",
                    "params": {
                        "date_field": "created_at",
                        "format": "EEEEEE"
                    }
                }
            }
        } 
    }
    

提交回复
热议问题