Логировать медленные запросы
#
curl -XPUT 'http://localhost:9200/_all/_settings?preserve_existing=true' -H 'Content-Type: application/json' -d '{
"index.indexing.slowlog.threshold.index.info" : "1s",
"index.indexing.slowlog.threshold.index.warn" : "1500ms",
"index.search.slowlog.threshold.query.warn": "1s",
"index.search.slowlog.threshold.query.info": "500ms",
"index.search.slowlog.threshold.query.debug": "1500ms",
"index.search.slowlog.threshold.query.trace": "300ms",
"index.search.slowlog.threshold.fetch.warn": "500ms",
"index.search.slowlog.threshold.fetch.info": "400ms",
"index.search.slowlog.threshold.fetch.debug": "300ms",
"index.search.slowlog.threshold.fetch.trace": "200ms"
}'
Копирование индекса между кластерами
#
export INDEX=index
elasticdump \
--input=http://localhost:9200/$INDEX \
--output=http://localhost:9300/$INDEX \
--type=analyzer
elasticdump \
--input=http://localhost:9200/$INDEX \
--output=http://localhost:9300/$INDEX \
--type=mapping
elasticdump \
--input=http://localhost:9200/$INDEX \
--output=http://localhost:9300/$INDEX \
--type=data --limit=10000
Шаблон с репликами и шардами для новых индексов
#
curl -H 'Content-Type: application/json' -XPOST 'http://localhost:9000/_template/default' -d '{ "index_patterns": ["*"], "settings": { "number_of_shards": "3", "number_of_replicas": "1" } }'
Снепшоты
#
curl -H 'Content-Type: application/json' -X PUT -d \
'{
"type": "s3",
"settings": {
"region": "us-east-1",
"bucket": "backup",
"endpoint": "minio:9000",
"path_style_access": "true",
"client": "default",
"protocol": "http"
}
}' localhost:9200/_snapshot/backup?pretty
curl -XPUT localhost:9200/_snapshot/backup/snap1\?wait_for_completion=true