인덱스 존재 확인 API (Index Exists API)
index exists API 연산은 인덱스가 이미 존재하는지 여부를 반환해요.
출처: OpenSearch 문서
본문
Endpoints
HEAD /{index-name}
Query parameters
모든 파라미터는 선택사항이에요.
| Parameter | Type | Description | | allow_no_indices | Boolean | Whether to ignore wildcards that don’t match any indexes. Default is true. | | expand_wildcards | String | Expands wildcard expressions to different indexes. Combine multiple values with commas. Available values are all (match all indexes), open (match open indexes), closed (match closed indexes), hidden (match hidden indexes), and none (do not accept wildcard expressions). Default is open. | | flat_settings | Boolean | Whether to return settings in the flat form, which can improve readability, especially for heavily nested settings. For example, the flat form of “index”: { “creation_date”: “123456789” } is “index.creation_date”: “123456789”. | | include_defaults | Boolean | Whether to include default settings as part of the response. This parameter is useful for identifying the names and current values of settings you want to update. | | ignore_unavailable | Boolean | If true, OpenSearch does not search for missing or closed indexes. Default is false. | | local | Boolean | Whether to return information from only the local node instead of from the cluster manager node. Default is false. |
Example request
REST Python
HEAD /sample-index
Copy Copy as cURL
response = client.indices.exists(
index = "sample-index"
)
Copy
Example response
index exists API 연산은 두 가지 응답 코드 중 하나만 반환해요. 200은 인덱스가 존재한다는 뜻이고, 404는 인덱스가 존재하지 않는다는 뜻입니다.
Required permissions
Security 플러그인을 사용한다면 적절한 권한(indices:admin/exists)을 가지고 있는지 확인하세요.