【问题标题】:How to perform faceting to group results by other fields in Elastic Search如何在 Elastic Search 中按其他字段对结果进行分面分组
【发布时间】:2014-02-05 11:58:30
【问题描述】:

我有一个如下所示的文档映射:

_id : integer
title: string
category: string
country: string

如果按“标题”进行搜索,我想获得在所有类别和所有国家/地区找到的结果数量,例如

countries:
   USA: 38
   UK: 17
   ES: 5
   ....

categories:
   Animals: 6
   People:  772
   Objects: 87
   ....

是否可以在 Elastic Search 中执行此操作?

谢谢

【问题讨论】:

    标签: php elasticsearch faceted-search


    【解决方案1】:

    是的,这是 Elasticsearch 中分面的标准行为。有关更多信息和示例,请参阅Elasticsearch Facets documentation

    【讨论】:

    • 好的!抱歉,我无法重现这样的行为,看起来我在询问方面时使用的是“过滤器”而不是“术语”......谢谢
    猜你喜欢
    • 2016-01-23
    • 1970-01-01
    • 2012-01-08
    • 2018-07-20
    • 1970-01-01
    • 2019-12-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多