c# - 无需滚动即可获取文档属性值 - 下一个弹性搜索
问题描述
我已经用这种简化的结构索引了文档:
public class Document
{
public string Id { get; set; }
public string x { get; set; }
}
我正在像这样搜索它们:
var initialResponse = client.Search<Document>(s => s.From(0)
.Size(100).Scroll(scrollTimeout)
.Query(q => q
.MatchPhrase(c => c
.Field(p => p.Attachment.Content)
.Analyzer("standard")
.Boost(1.1)
.Query(searchTerm)
)));
然后遍历文档(更多代码在这里)。这显然需要时间,我想知道是否可以在一个有效负载中获得匹配文档的所有 ID 甚至更好的 x 值?
谢谢!
解决方案
Elasticsearch 有index.max_result_window
一个默认值为 10,000 的设置。
这是您可以在单个请求中检索的最大文档数。如果你想获得更多——你需要使用scroll
API search_after
,就像你已经做的那样。
推荐阅读
- excel - FormulaArray 突击队不适用于 VBA 执行代码
- php - PHP如何循环嵌套的JSON对象?
- python - 绘制虚拟变量 == 1 和系列中的单独变量 == 1 的计数条形图
- flutter - 如何更改颤振 filterChip 中的复选图标颜色
- sql - 将复制值从 A 列插入到 B 列后创建触发器
- c++ - 向 OpenCL 项目函数添加参数时出现链接器问题
- c# - RestSharp - .AddParameter 是否添加到 POST 请求的 Header 或 Body 中?
- c# - 如何查询数据库以仅包含 API Json 的搜索元素及其路径?
- python - 如何用 selenium python 删除/替换文本?
- python - 为什么 TensorFlow WHL 文件不包含所有必需的依赖项?