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_ 开头的所有索引,并定义了相应的映射和设置。
相关推荐
小白学大数据9 分钟前
爬虫进阶:Selenium与Ajax的无缝集成
大数据·开发语言·爬虫·selenium·ajax
小冷在努力41 分钟前
elasticsearch入门基本知识+使用案例
大数据·elasticsearch·搜索引擎·es
2402_857589361 小时前
WebKit中Websockets的全面支持:实现高效实时通信
大数据·前端·webkit
一切如来心秘密3 小时前
kafka 实现精确一次性语义实践总结
大数据·kafka
lupai3 小时前
车牌号查车辆信息-车牌号查车辆信息接口-汽车API接口
大数据·汽车·生活
薛定谔的猫66665 小时前
主流电商平台营销中大数据的应用◆
大数据·数据采集·淘宝天猫·电商api·主流平台·阿里巴巴1688·独立站系统
迅狐源码工厂5 小时前
如何选择快手矩阵系统:打造高效短视频营销的指南
大数据·人工智能·矩阵
GSDjisidi5 小时前
日本IT-SIER/SES的区别详情、契约形态等
java·大数据·c语言·c++·php
小的~~6 小时前
大数据面试题之Flink(4)
大数据·flink
大舍传媒6 小时前
欧美海外媒体发稿,国外新闻发布,外媒发布
大数据·人工智能·游戏引擎·信息与通信·用户运营