Graylog解决超出ES搜索最大窗口限制问题

今天在查询日志的时候graylog报了一个错:

While retrieving data for this widget, the following error(s) occurred:

Unable to perform search query: Elasticsearch exception type=illegal_argument_exception, reason=Result window is too large, from + size must be less than or equal to: \[10000 but was 12081150. See the scroll api for a more efficient way to request large data sets. This limit can be set by changing the index.max_result_window index level setting.].

说是ES默认设置最大搜索窗口(index.max_result_window)为10000条,也是是搜索可以返回的条数

查了下可以修改index.max_result_window

1.修改现有的索引

在ES所在的服务器中输入以下指令

curl -H "Content-Type: application/json" -XPUT http://127.0.0.1:9200/_all/_settings -d '{ "index" : { "max_result_window" : 1000000}}'

2.修改索引模板,从而新创建的索引也修改index.max_result_window

curl -H "Content-Type: application/json" -XPUT http://127.0.0.1:9200/_template/graylog-gdmp-mapping -d '{

"order": 1,

"index_patterns": [

"gdmp_*"

],

"settings": {

"index": {

"analysis": {

"analyzer": {

"analyzer_keyword": {

"filter": "lowercase",

"tokenizer": "keyword"

}

}

},

"max_result_window": 1000000

}

},

"mappings": {

"_source": {

"enabled": true

},

"dynamic_templates": [

{

"internal_fields": {

"mapping": {

"type": "keyword"

},

"match_mapping_type": "string",

"match": "gl2_*"

}

},

{

"store_generic": {

"mapping": {

"type": "keyword"

},

"match_mapping_type": "string"

}

}

],

"properties": {

"streams": {

"type": "keyword"

},

"message": {

"fielddata": false,

"analyzer": "standard",

"type": "text"

},

"timestamp": {

"format": "uuuu-MM-dd HH:mm:ss.SSS",

"type": "date"

}

}

}

}'

  • 这个 cURL 命令的目的是在 Elasticsearch 中创建或更新名为 graylog-gdmp-mapping 的模板,该模板适用于以 gdmp_ 开头的所有索引,并定义了相应的映射和设置。
相关推荐
千桐科技27 分钟前
qData 数据中台开源版从 MySQL 到 Doris完成一次数据同步
大数据·mysql·开源·doris·数据中台·qdata
ACP广源盛139246256733 小时前
GSV6155@ACP# 搭配 AI 服务器、AI PC 完整适配方案
大数据·服务器·人工智能·分布式·单片机·嵌入式硬件
stonewl25994 小时前
2026化工行业 GHS/CLP 国产标签打印软件合规打印方案
大数据·人工智能·物联网
Wzx1980124 小时前
Redis&ES——Retriever的抽象实现
数据库·人工智能·redis·elasticsearch
xywww1685 小时前
AWS 账号权限怎么分:根用户和 IAM 用户区别及日常使用建议
大数据·开发语言·人工智能·python·gpt·云计算·aws
牛奶咖啡135 小时前
大数据Hadoop运维应用实践——双NameNode高可用Hadoop集群架构(下)
大数据·hadoop·hadoop集群配置文件解析·hadoop高可用集群安装部署·配置指定多台服务器相互免密·配置hadoop服务开机自启·ansible部署hadoop
在水一缸5 小时前
深度解析 GPT-5.6:大模型架构演进与复杂任务实战指南
大数据·人工智能·gpt·架构·大模型·架构演进·gpt-5.6
无忧智库6 小时前
智慧电厂:引领发电行业新革命(PPT)
大数据·人工智能
小果因子实验室6 小时前
量化研究--编写第一个回测算法策略研究
大数据·区块链
chenyulin45457 小时前
企业微信API二次开发:万级并发回调下的极致幂等性设计与防重放架构实战
大数据·人工智能·安全·架构·企业微信