| 索引级设置 | index.search.slowlog.threshold.query.*、index.search.slowlog.threshold.fetch.*、index.indexing.slowlog.threshold.index.* |
|---|---|
| 日志输出 | config/log4j2.properties 里配置 slowlog 对应 logger 与文件名 |
| 默认值 | 阈值默认 -1 表示关闭;开启时显式设置时长如 5s |
示例
示例
PUT /my-index/_settings
{
"index": {
"search.slowlog.threshold.query.warn": "10s",
"search.slowlog.threshold.query.info": "5s",
"search.slowlog.threshold.fetch.warn": "1s",
"indexing.slowlog.threshold.index.info": "5s"
}
}慢日志包含查询主体与 query/fetch 耗时分解,是优化查询语句的主要依据;日志本身也占 IO,阈值不要过低。