LoginSignup
1
0

More than 3 years have passed since last update.

基本的なElasticsearchの検索クエリ

Last updated at Posted at 2018-12-29

Elasticsearchのクエリ力がなさすぎて、
毎回調べてしまう基本的な検索クエリのメモです。

随時更新していきます。

範囲(hogeが10以上)

{
  "query": {
    "range": {
      "hoge": {"gte": 10}
    }
  }
}

削除クエリ

POST /my-index/_delete_by_query
{
  "query": {
    ...
  }
}

検索クエリ以外

シャードの状態確認

GET _cat/shards?h=index,shard,prirep,state,unassigned.reason

Disk Sizeの確認

GET _nodes/stats

結果のdataのfree_in_bytes

        "data" : [
          {
            "path" : "/var/lib/elasticsearch/127.0.0.1-node/nodes/0",
            "mount" : "/ (/dev/sda1)",
            "type" : "ext4",
            "total_in_bytes" : 84482068480,
            "free_in_bytes" : 18353790976,
            "available_in_bytes" : 14794018816
          }
        ],

Snapshot

PUT _snapshot/my_gcs_repository/backup-20190523
{
  "indices": ["uga-v1"],
  "ignore_unavailable": true,
  "include_global_state": false
}

Restore

POST _snapshot/my_gcs_repository/backup-20190523/_restore?pretty
{
  "indices": "uga-v1",
  "ignore_unavailable": true,
  "include_global_state": false,
  "include_aliases": false,
  "rename_pattern": "uga-v1", 
  "rename_replacement": "uga-v1-1" 
}
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0