首页 > 解决方案 > Elasticsearch 分片请求缓存中的 size=0 是什么意思?

问题描述

By default, the requests cache will only cache the results of search requests where size=0, so it will not cache hits, but it will cache hits.total, aggregations, and suggestions.

我不明白声明的部分:“size=0”。

这里的大小上下文/含义是什么?

这是否意味着结果缓存将

标签: elasticsearchcachingrequest

解决方案


不,如果您想获取不同于 10 的结果,大小参数很有用,因为默认大小为 10,因此如果您使用需要获取的搜索查询,假设 1000 个结果,而不是将大小参数指定为 1000,而无需这样您将只获得前 10 个搜索结果,并按其分数降序排列。

size=0,在分片请求缓存中,它不会缓存确切的结果(即带有分数的文档数量),而只会缓存结果总数(即 hits.total)等元数据。


推荐阅读