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_ 开头的所有索引,并定义了相应的映射和设置。
相关推荐
m0_619731197 分钟前
libmodbusTcp发送自定义功能码
大数据·elasticsearch·搜索引擎
Ashley_Amanda8 分钟前
SAP ABAP 开发全攻略:从核心编程到最佳实践
大数据·数据库·sql
彭思远200637 分钟前
以 MapReduce 之力,解锁螺蛳粉销量数据的有序密码
大数据·mapreduce
黎相思1 小时前
附录:ChatSDK使用
大数据·elasticsearch·搜索引擎
geneculture1 小时前
融智学:重构认知与实践的智慧体系
大数据·人工智能·融智学的重要应用·信智序位·人类智力·融智时代(杂志)
泰迪智能科技1 小时前
分享|大数据人工智能实验室合作案例举例
大数据·人工智能·科技
熊文豪1 小时前
时序数据库选型指南:如何为大数据场景选择合适的时序数据库
大数据·数据库·时序数据库·iotdb
RPA机器人就选八爪鱼1 小时前
RPA批量采集抖音评论高效攻略:精准获取用户反馈与市场洞察
大数据·人工智能·机器人·rpa
武汉唯众智创1 小时前
云计算与大数据实训室系列产品介绍
大数据·云计算·云计算实训室·大数据实训室·云计算实验室·云计算大数据·云计算大数据实训室