美文网首页
exception----trying to create to

exception----trying to create to

作者: 不过意局bugyj | 来源:发表于2019-11-05 09:25 被阅读0次

    错误:

    trying to create too many buckets. must be less than or equal to: [100000] but was [100001]. this limit can be set by changing the [search.max_buckets] cluster level setting.

    描述:

    需实现的需求是以 doc中的三个参数进行分组,因为es库中存在300多万条数据,所以分组起来会有很多的bucket,而es默认桶上限是10000,所以我们需要设置相关参数,即上文说的search.max_bucket。

    解决:

    我用的语言是python,我就直接贴代码:

    # 2147483647是2的31次方减1,最大桶数
    es.cluster.put_settings(body='{"transient": {"search.max_buckets": 2147483647}}')
    

    curl方式:
    curl -H 'Content-Type: application/json' ip:port/_setting/cluster -d '{
    "transient": {
    "search.max_buckets": 217483647
    }
    }'

    注意:es中还有默认按doc_count降序显示top10的桶,所以上面的设置也不能使返回的桶变多,所以还需在aggs的子参数下面加上 size=xxx

    相关文章

      网友评论

          本文标题:exception----trying to create to

          本文链接:https://www.haomeiwen.com/subject/eztsbctx.html