假设我有以下字段:
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 方面,但似乎如果我将字段指定为日期,我会得到一些随机键和一些没有意义的随机计数......
我尝试过的...给定具有指定“字段=时间戳”的日期直方图,我得到以下似乎没有意义的输出。它需要一个键字段和一个值字段,其值字段必须是整数?这没有多大意义......并且没有考虑到我想要的具体条件。
myhistogram: {
_type: "date_histogram",
entries: [
{},
{
count: 1,
time: 634579946870400000
},
{
count: 1,
time: 634580073100800000
}]}