---
title: "elasticsearch慢查询日志"
author: "leichenlei"
date: "2017-07-19T18:00:16Z"
tags: []
categories: ["互联网"]
slug: "elasticsearch"
draft: false
lastmod: "2017-07-19T18:00:16Z"
id: 2385079
url: "https://leichenlei.iteye.com/blog/2385079"
---

调用如下api

 

```
这是集群级别的api
/_cluster/settings/

{
  "transient": {
    "logger.index.search.slowlog": "DEBUG",
    "logger.index.indexing.slowlog" : "INFO"
  }
}


这个是索引级别的api：
/索引名/_settings/

{
    "index.search.slowlog.threshold.query.debug" : "20ms", 
    "index.search.slowlog.threshold.fetch.debug": "20ms", 
    "index.indexing.slowlog.threshold.index.info": "20ms" 
}
```