小编ant*_*ken的帖子

如何加速apache POI中的自动调整列?

我使用以下代码来自动调整电子表格中的列:

for (int i = 0; i < columns.size(); i++) {
   sheet.autoSizeColumn(i, true);
   sheet.setColumnWidth(i, sheet.getColumnWidth(i) + 600);
}
Run Code Online (Sandbox Code Playgroud)

问题是,如果大型电子表格超过3000行,则每列自动调整大小需要10分钟以上.尽管如此,它对于小文档来说非常快.有什么能帮助自动化更快地工作吗?

java excel performance autosize apache-poi

22
推荐指数
1
解决办法
2万
查看次数

如何在 AWS ElasticSearch Service 中获取触发警报中的变量值?

我正在尝试通过 AWS ElasticSearchService Monitor Alert Trigger 在 Slack 上发布详细消息。我尝试使用描述中的变量 https://opendistro.github.io/for-elasticsearch-docs/docs/alerting/monitors/

警报被触发并发布在 Slack 上,但当我尝试在行动中使用它们时,大多数变量都是空的。我只从ctx.trigger.name, ctx.periodStart,获取信息ctx.periodEnd。像ctx.trigger.condition, ctx.results[0], ctx.error, 之类的变量ctx.results[0].hits.total是空的,而文档说ctx.error如果ctx.results[0]是空的,就会被填充。

如何获取更多数据?我的查询是否以某种方式限制了它?

我的监视器提取查询如下:

{
    "size": 20,
    "query": {
        "constant_score": {
            "filter": {
                "bool": {
                    "must": [
                        {
                            "range": {
                                "@timestamp": {
                                    "from": "now-1m",
                                    "to": null,
                                    "include_lower": true,
                                    "include_upper": true,
                                    "boost": 1
                                }
                            }
                        }
                    ],
                    "must_not": [
                        {
                            "match": {
                                "status": {
                                    "query": "200",
                                    "operator": "OR",
                                    "prefix_length": 0,
                                    "max_expansions": …
Run Code Online (Sandbox Code Playgroud)

elasticsearch aws-elasticsearch elasticsearch-opendistro

1
推荐指数
1
解决办法
1736
查看次数