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_ 开头的所有索引,并定义了相应的映射和设置。
相关推荐
赞奇科技Xsuperzone7 小时前
【首发】DGX Spark 三机互连跑 Qwen3-235B-A22B-FP8!
大数据·分布式·spark
leijiwen9 小时前
Bsin X BDCM:从流量驱动到价值激励驱动的智能增长引擎
大数据·人工智能·web3
fruge9 小时前
Git 进阶技巧:分支管理、冲突解决、提交规范实操
大数据·git·elasticsearch
1***y1789 小时前
区块链跨链桥、 跨链桥到底在解决什么问题?
大数据·人工智能·区块链
金融小师妹11 小时前
基于LSTM-GARCH混合模型:降息预期驱动金价攀升,白银刷新历史峰值的蒙特卡洛模拟验证
大数据·人工智能·深度学习·1024程序员节
有味道的男人11 小时前
速卖通商品详情接口(速卖通API系列)
java·大数据·数据库
天远云服11 小时前
Golang 硬核实战:手撸 AES-CBC 算法,对接天远风控决策接口
大数据·api
天远数科11 小时前
Node.js 全栈实战:5分钟对接天远风控 API与数据清洗
大数据·api
老蒋新思维11 小时前
创客匠人 2025 峰会深度解析:AI 赋能垂直领域,创始人 IP 变现的差异化路径
大数据·网络·人工智能·网络协议·tcp/ip·重构·知识付费
EveryPossible12 小时前
大数据优化
大数据