How to show day names,using date-histogram aggregation in elascticsearch

后端 未结 3 821
生来不讨喜
生来不讨喜 2020-12-09 22:42

I have been trying to use date histogram aggregation in elasticsearch and it returns the date as epoch or in yy-mm-dd-mm-ss format. But what I want is to get document count

3条回答
  •  没有蜡笔的小新
    2020-12-09 23:01

    For ES5 using painless, this works:

    "aggs": {
        "dayOfWeek": {
            "terms": {
                "script": {
                    "inline": "doc['date_utc'].date.dayOfWeek",
                    "lang": "painless"
                }
            }
        }
    }
    

提交回复
热议问题