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_ 开头的所有索引,并定义了相应的映射和设置。
相关推荐
木头程序员5 分钟前
持续学习(Continual/Lifelong Learning)综述
大数据·人工智能·深度学习·机器学习
Hello.Reader10 分钟前
Apache Cassandra Connector:Flink 与宽列存储的高吞吐协作
大数据·flink·apache
中國龍在廣州14 分钟前
35天,成了AI 模型的斩杀线
大数据·人工智能·深度学习·算法·机器人
Gofarlic_oms19 小时前
Windchill用户登录与模块访问失败问题排查与许可证诊断
大数据·运维·网络·数据库·人工智能
Zoey的笔记本9 小时前
2026告别僵化工作流:支持自定义字段的看板工具选型与部署指南
大数据·前端·数据库
lingling00910 小时前
2026 年 BI 发展新趋势:AI 功能如何让数据分析工具 “思考” 和 “对话”?
大数据·人工智能·数据分析
鹧鸪云光伏10 小时前
光伏项目多,如何高效管理?
大数据·人工智能·光伏
Acrel1870210670610 小时前
浅谈电气防火限流保护器设计在消防安全中的应用价值
大数据·网络
赵谨言10 小时前
Python串口的三相交流电机控制系统研究
大数据·开发语言·经验分享·python
汇智信科11 小时前
智慧矿山 & 工业大数据创新解决方案 —— 智能能源管理系统
大数据·能源·智慧矿山·工业大数据·汇智信科·智能能源管理系统·多元维度