[英]Search API for ElasticSearch not returning all the logs
I am wanting to get all the logs from elasticsearch from a asp.net core web api application using NEST.我想从 asp.net 核心 web Z8A5DA52ED126447D8AAZE7 使用应用程序 NEST.A5DA52ED1264721 I created a controller named
ESController
to get the logs that are in elasticsearch.我创建了一个名为
ESController
来获取 elasticsearch 中的日志。 However, when I do so, on swagger it only displays the first log and not the entire list of logs.但是,当我这样做时,在 swagger 上它只显示第一个日志,而不是整个日志列表。 I even wrote to the console to see if I can view those logs there as well but it does not display.
我什至写信给控制台,看看我是否也可以在那里查看这些日志,但它没有显示。 I do not have a model class for the logs.
我没有用于日志的 model class。 Is there something wrong I am doing to retrieve/extract the logs from elasticsearch in the .net application?
我在 .net 应用程序中从 elasticsearch 检索/提取日志有什么问题吗?
Console displays: "Valid NEST response built from a successful (200) low level call on POST: /elastic-search-app-logs%2A/_search?typed_keys=true"控制台显示:“从 POST 上成功的 (200) 低级别调用构建的有效 NEST 响应:/elastic-search-app-logs%2A/_search?typed_keys=true”
swagger: swagger:
Correct me if I am wrong, but in the ElasticSearch CLI running the command below will display the logs from elasticsearch:如果我错了,请纠正我,但在 ElasticSearch CLI 中运行以下命令将显示来自 elasticsearch 的日志:
GET elastic-search-app-logs*/_search
{
"query": {
"match_all": {}
}
}
So what I am trying to do is translate this code into .net with NEST.所以我想做的是用 NEST 将此代码翻译成 .net。
The logs I am wanting to read/extract from elasticsearch into a .net application我想从 elasticsearch 读取/提取的日志到 .net 应用程序
Any pointers/suggestions would be greatly appreciated!!任何指针/建议将不胜感激!!
The _search
API is limited in the number of results it will return, even with a match_all
filter. _search
API 将返回的结果数量受到限制,即使使用match_all
过滤器也是如此。
The traditional way to get all results from Elasticsearch is scroll search .从 Elasticsearch 获取所有结果的传统方法是滚动搜索。 More recently the recommended approach is to use
search_after
instead (see the scroll search link for more info).最近推荐的方法是使用
search_after
代替(有关更多信息,请参阅滚动搜索链接)。
Docs for the NEST client cover both search_after and scrolling . NEST 客户端的文档涵盖了search_after和scrolling 。
The _search
API is limited to 10,000 results by default. _search
API 默认限制为 10,000 个结果。 While it's not recommended, you can change the limit with the index.max_result_window
index setting .虽然不建议这样做,但您可以使用
index.max_result_window
索引设置更改限制。
[edit: typo fix] [编辑:错字修复]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.