DBAtlas · Database operations atlas

Enable the search and indexing slow log (per-index thresholds)

ElasticsearchPerformance

Command

PUT musteri/_settings
{
  "index.search.slowlog.threshold.query.warn": "2s",
  "index.search.slowlog.threshold.query.info": "500ms",
  "index.search.slowlog.threshold.fetch.warn": "1s",
  "index.indexing.slowlog.threshold.index.warn": "1s",
  "index.indexing.slowlog.source": "200"
}
GET musteri/_settings/index.*slowlog*?flat_settings=true
# Set thresholds to null to turn it off:
PUT musteri/_settings
{
  "index.search.slowlog.threshold.query.warn": null,
  "index.search.slowlog.threshold.query.info": null,
  "index.search.slowlog.threshold.fetch.warn": null,
  "index.indexing.slowlog.threshold.index.warn": null,
  "index.indexing.slowlog.source": null
}

What it does

For a given index, writes requests exceeding the threshold in the query and fetch phases and in indexing to the slow log, together with the query body.

When to use it

To find which query causes slow searches, or to catch heavy queries from a specific dashboard or client.

Caution

The threshold is measured per shard: on an index with many shards each shard can write its own line. A very low threshold (0ms) significantly increases log volume and IO; turn it off with null after the diagnosis. indexing.slowlog.source writes the document source to the log; set it to false if it contains sensitive data. The setting applies only to the given index; add it to the template for new indices.

Open in DBAtlas →

Related