elasticsearch-dsl aggregations returns only 10 results. How to change this

寵の児 提交于 2019-12-05 09:22:39
Soony

I had the same issue. I finally found this solution:

s = Search(using=client, index="jokes").query("match", jks_content=keywords).extra(size=0)
a = A('terms', field='jks_title.keyword', size=999999)
s.aggs.bucket('by_title', a)
response = s.execute()

After 2.x, size=0 for all bucket results won't work anymore, please refer to this thread. Here in my example I just set the size equal 999999. You can pick a large number according to your case.

It is recommended to explicitly set reasonable value for size a number between 1 to 2147483647.

Hope this helps.

fmdaboville

You should read the documentation.

So in your case, this should be like this :

search.aggs.bucket('per_date', 'terms', field='date')\
            .bucket('response_time_percentile', 'percentiles', field='total_time',
                    percents=percentiles, hdr={"number_of_significant_value_digits": 1})[0:50]
response = search.execute()
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!