ビットの海

ゆるふわソフトウェアエンジニアしゃぜのブログ

Elasticsearch チートシート

クエリパラメータ

  • responseの整形
    • ?pretty
  • カラムヘッダの表示
    • ?v

Index操作

  • index一覧
    • GET /_cat/indices?v
  • index削除
    • DELETE /{index_name}}
  • index open
    • POST /{index_name}/_open
  • index close
    • POST /{index_name}/_close

Alias操作

  • alias 一覧
    • GET /_cat/aliases
  • aliasにindexをremoveして、add
POST /_aliases
{
  "actions" : [
    {"remove": {"index": "{index_name_v1}", "alias": "{alias_name}" }},
    {"add" :   {"index": "{index_name_v2}", "alias": "{alias_name}" }}
  ]
}'

検索

  • 無条件検索
    • GET /{index_name}/_search

監視

古い index の自動削除設定

PUT /_cluster/settings
{
    "persistent": {
        "xpack.monitoring.exporters.__no-default-local__": {
            "type": "local",
            "enabled": true
        }
    }
}

GET _cluster/settings?filter_path=*.xpack.monitoring.exporters