获取设置
1.0 版引入
get settings API 操作返回您索引中的所有设置。
端点
GET /_settings
GET /<target-index>/_settings
GET /<target-index>/_settings/<setting>
路径参数
参数 | 数据类型 | 描述 |
---|---|---|
<目标索引> | 字符串 | 要获取设置的索引。可以是逗号分隔的列表,用于从多个索引中获取设置,或者使用 _all 返回集群中所有索引的设置。 |
<设置> | 字符串 | 过滤以返回特定设置。 |
查询参数
所有获取设置参数都是可选的。
参数 | 数据类型 | 描述 |
---|---|---|
allow_no_indices | 布尔型 | 是否忽略不匹配任何索引的通配符。默认值为 true 。 |
expand_wildcards | 字符串 | 将通配符表达式扩展到不同的索引。使用逗号组合多个值。可用值包括 all (匹配所有索引)、open (匹配开放索引)、closed (匹配关闭索引)、hidden (匹配隐藏索引)和 none (不接受通配符表达式),none 必须与 open 、closed 或两者结合使用。默认值为 open 。 |
flat_settings | 布尔型 | 是否以扁平形式返回设置,这可以提高可读性,特别是对于深度嵌套的设置。例如,“index”: { “creation_date”: “123456789” } 的扁平形式是 “index.creation_date”: “123456789”。 |
include_defaults | 布尔型 | 是否在响应中包含默认设置,包括 OpenSearch 插件中使用的设置。默认值为 false 。 |
ignore_unavailable | 布尔型 | 如果为 true,OpenSearch 不会在响应中包含缺失或关闭的索引。 |
local | 布尔型 | 是否仅从本地节点返回信息,而不是从集群管理器节点返回。默认值为 false 。 |
cluster_manager_timeout | 时间 | 等待连接到集群管理器节点的时间。默认值为 30s 。 |
请求示例
GET /sample-index1/_settings
示例响应
{
"sample-index1": {
"settings": {
"index": {
"creation_date": "1622672553417",
"number_of_shards": "1",
"number_of_replicas": "1",
"uuid": "GMEA0_TkSaamrnJSzNLzwg",
"version": {
"created": "135217827",
"upgraded": "135238227"
},
"provided_name": "sample-index1"
}
}
}
}