简体   繁体   English

弹性搜索:获取此结果集的可用构面/聚合的列表

[英]Elastic Search: Get A List Of Available Facets / Aggregations For This Result Set

In Elastic Search I need to obtain a list of available Aggregations (formally Facets?) for the current result-set. 在Elastic Search中,我需要获取当前结果集的可用聚合列表(正式为Facets?)。

For example, if I do a search for "car" in a set of cars which have defined MAKE and MODEL fields, I would like it to not only give me a result set of cars, but also a list of makes and models I can filter by. 例如,如果我在定义了MAKE和MODEL字段的一组汽车中搜索“ car”,我希望它不仅可以给我一组汽车的结果,还可以提供我可以过滤。

From what I can read, you have to request the aggregations you want. 据我所读,您必须请求所需的聚合。 That can't be right because if I was eBay and I had a catalogue with hundreds of possible attributes, all of which are searchable, then telling the search engine what facets I would like to search by would be unscalable. 那可能是不对的,因为如果我是eBay并且我的目录中包含数百种可能的属性,所有这些属性都是可搜索的,那么告诉搜索引擎我想要搜索的面是不可扩展的。

I'm Using: 我正在使用:

  • Elastic Search 弹性搜寻
  • PHP Elastica Client PHP Elastica客户端

I would expect to simply be able to call Elastica/ResultSet.php::getAggregations() on Line 194 here: 我希望可以简单地在第194行调用Elastica / ResultSet.php :: getAggregations():

Point of reference: 参考点:

Could someone please clarify what I need to do to achieve this? 有人可以说明我要实现这一目标需要做什么吗?

In Elasticsearch, you have to explicitly mention which fields you want to aggregate upon. 在Elasticsearch中,您必须明确提及要汇总的字段。 Why don't you implement a client side (client of Elasticsearch) logic of getting all the field names and build an Elasticsearch search request with aggregations for all those fields? 您为什么不实现获取所有字段名称的客户端(Elasticsearch的客户端)逻辑,并为所有这些字段生成带有聚集的Elasticsearch搜索请求?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM