ElasticSearch之Get index settings API

发布时间 2023-12-02 16:49:13作者: jackieathome

获取指定索引的参数的值。

获取指定索引的全部参数,命令样例如下:

curl -X GET "https://localhost:9200/testindex_002/_settings?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"

执行结果的样例,如下:

{
  "testindex_002" : {
    "settings" : {
      "index" : {
        "routing" : {
          "allocation" : {
            "include" : {
              "_tier_preference" : "data_content"
            }
          }
        },
        "number_of_shards" : "3",
        "provided_name" : "testindex_002",
        "creation_date" : "1701498436722",
        "number_of_replicas" : "2",
        "uuid" : "k6twq9y9Qtmcs2AHK-USEQ",
        "version" : {
          "created" : "8500003"
        }
      }
    }
  }
}

获取指定索引的指定参数,精确指定参数名,命令样例如下:

curl -X GET "https://localhost:9200/testindex_002/_settings/index.number_of_shards?pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"
{
  "testindex_002" : {
    "settings" : {
      "index" : {
        "number_of_shards" : "3"
      }
    }
  }
}

获取指定索引的指定参数,模糊匹配参数名,命令样例如下:

curl -X GET "https://localhost:9200/testindex_002/_settings/index.translog.*?flat_settings=true&include_defaults=true&pretty" --cacert $ES_HOME/config/certs/http_ca.crt -u "elastic:ohCxPH=QBE+s5=*lo7F9"
{
  "testindex_002" : {
    "settings" : { },
    "defaults" : {
      "index.translog.durability" : "REQUEST",
      "index.translog.flush_threshold_age" : "1m",
      "index.translog.flush_threshold_size" : "10gb",
      "index.translog.generation_threshold_size" : "64mb",
      "index.translog.retention.age" : "-1",
      "index.translog.retention.size" : "-1",
      "index.translog.sync_interval" : "5s"
    }
  }
}

方法参数
flat_settings
include_defaults
ignore_unavailable
local

相关资料