【问题标题】:How to facet/histogram the following in elasticsearch?如何在弹性搜索中对以下内容进行刻面/直方图?
【发布时间】:2013-06-18 04:15:42
【问题描述】:

假设我有以下字段:

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
}]}

【问题讨论】:

    标签: elasticsearch


    【解决方案1】:

    日期直方图支持用于分桶的“value_field”参数,但它仅支持数值。 有一个插件elasticfacets 似乎允许将日期直方图方面与任何其他方面一起使用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-26
      • 1970-01-01
      • 2017-02-28
      • 1970-01-01
      • 2019-01-29
      • 2020-12-01
      • 2014-06-07
      相关资源
      最近更新 更多