You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何调整ONGRFilterBundle动态聚合筛选默认选项数量以获取全部选项?

How to Fetch All Options in ONGRFilterBundle's Dynamic Aggregate Filter

Got it! The default limit of 10 options in the dynamic_aggregate filter comes from Elasticsearch's default aggregation bucket size, which ONGR's bundle uses out of the box. To get all available options instead, you just need to add the size option to your filter configuration and set it to a sufficiently large value (or 0 if you're using an Elasticsearch version that supports it—though a high explicit number like 1000 is safer to avoid unexpected behavior).

Here's your updated configuration with the necessary change:

ongr_filter_manager:
    managers:
        # ... your existing manager config
    filters:
        dynamic_attributes:
            type: dynamic_aggregate
            request_field: attributes
            document_field: attributes>attributes.value
            options:
                name_field: attributes.name
                show_zero_choices: false
                size: 1000 # Add this line to override the default 10 limit

Quick Explanation:

  • The size option directly controls how many aggregation buckets (your filter options) Elasticsearch returns.
  • If you know the exact maximum number of options your attributes field can have, you can set size to that number. If you're unsure, a high value like 1000 will cover most use cases without performance issues (as long as you don't have tens of thousands of unique options—if you do, you might want to reconsider the UX of showing all options at once!).

内容的提问来源于stack exchange,提问作者Borja Pombo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 09:26:55