说我有以下字段:
timestamp: (elasticsearch date field)
ice-cream-flavor: (e.g. Chocolate, Vanilla, Strawberry)
container: (e.g. Cup, Cone)
我希望能够使用某种方面根据以下内容给我一个计数:
timestamp: (bucketed by day)
ice-cream-flavor count (how many Chocolate on that day? How many Vanilla that day?)
我可以更进一步做一下:
我希望能够使用某种方面根据以下内容给我一个计数:
timestamp: (bucketed by day)
ice-cream-flavor count (how many Chocolate on that day? How many Vanilla that day?)
container count (based on time bucketed by day, could I get the count of how many of each ice cream flavor were stored in a container?)
这可能吗?这是什么样的方面?你能提供一个例子吗?我尝试使用DateHistogram和Histogram facet但似乎如果我将该字段指定为日期,我会得到一些随机密钥,其中包含一些没有意义的随机数....
我尝试过的...... 给定具有指定“field = timestamp”的日期直方图,我得到以下输出似乎毫无意义。它期望一个关键字段和一个值字段的值字段必须是一个整数?它没有多大意义......并没有考虑到我想要的具体条件。
myhistogram: {
_type: "date_histogram",
entries: [
{},
{
count: 1,
time: 634579946870400000
},
{
count: 1,
time: 634580073100800000
}]}