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_ 开头的所有索引,并定义了相应的映射和设置。
相关推荐
数字供应链安全产品选型8 分钟前
2026 AI安全趋势展望:AI原生安全将成为企业刚需
大数据·人工智能
桌面运维家13 分钟前
IDV云桌面vDisk机房课表联动部署方案
大数据·服务器·数据库
超级AI_mes32 分钟前
化工MES解决方案:从配方管控到安全追溯的智慧转型
大数据·人工智能·5g·能源·制造·业界资讯·设备采集
Mr数据杨44 分钟前
成人收入预测建模与信用评估应用
大数据·人工智能·机器学习·数据分析·kaggle
十六年开源服务商1 小时前
门户网站迁移WordPress完整方案2026
大数据
qyr67891 小时前
全球多旋翼无人机动力系统市场分析报告
大数据·人工智能·数据分析·市场报告·多旋翼无人机动力系统
腾讯云大数据1 小时前
腾讯云大数据出海实践:一套架构支撑跨国企业的全球数据平台
大数据·架构·云计算·腾讯云
juniperhan1 小时前
Flink 系列第12篇:Flink 维表关联详解
大数据·数据仓库·分布式·flink
如来神掌十八式2 小时前
Elasticsearch的dsl语句学习
elasticsearch
嘉立创FPC苗工2 小时前
多层 FPC 阻抗控制:从原理到实践的全流程指南
大数据·制造·fpc·电路板