【问题标题】:ElasticSearch Tire - How to configure to use a value field with date histogram facets?ElasticSearch Tire - 如何配置使用具有日期直方图方面的值字段?
【发布时间】:2013-01-04 21:59:27
【问题描述】:

我正在使用奇妙的轮胎宝石。但是,我在文档中找不到如何做到这一点。基本上,我想在轮胎的 date_histogram 中添加一个值字段。但是,我似乎无法对我尝试过的所有选项感到满意。

http://www.elasticsearch.org/guide/reference/api/search/facets/date-histogram-facet.html

目前可以这样做吗?

【问题讨论】:

    标签: ruby elasticsearch tire


    【解决方案1】:

    您只需在构面定义选项哈希中传递一个value_field

    Tire.search 'articles' do
      query { match :title, 'foo' }
      facet 'published_on' do
        date :published_on, value_field: 'words'
      end
    end
    

    我为此功能添加了一些integration tests

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-04-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多