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_ 开头的所有索引,并定义了相应的映射和设置。
相关推荐
数据与人工智能律师6 小时前
虚拟主播肖像权保护,数字时代的法律博弈
大数据·网络·人工智能·算法·区块链
一只专注api接口开发的技术猿7 小时前
企业级电商数据对接:1688 商品详情 API 接口开发与优化实践
大数据·前端·爬虫
今天我又学废了9 小时前
Spark,SparkSQL操作Mysql, 创建数据库和表
大数据·mysql·spark
杰克逊的日记11 小时前
Flink运维要点
大数据·运维·flink
markuszhang14 小时前
Elasticsearch 官网阅读之 Term-level Queries
大数据·elasticsearch·搜索引擎
帝锦_li15 小时前
ElasticSearch
elasticsearch·搜索引擎
Hello World......15 小时前
Java求职面试:从核心技术到大数据与AI的场景应用
大数据·java面试·技术栈·互联网大厂·ai服务
python算法(魔法师版)17 小时前
.NET NativeAOT 指南
java·大数据·linux·jvm·.net
星川皆无恙17 小时前
大模型学习:Deepseek+dify零成本部署本地运行实用教程(超级详细!建议收藏)
大数据·人工智能·学习·语言模型·架构
L耀早睡18 小时前
mapreduce打包运行
大数据·前端·spark·mapreduce