Skip to content

Commit 091bf49

Browse files
committed
add get_data_stream_lifecycle
1 parent 692dd1a commit 091bf49

File tree

4 files changed

+135
-11
lines changed

4 files changed

+135
-11
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,7 @@ npm run docs:dev
922922
- :heavy_check_mark: 推广数据流 [:link:](https://elasticsearch.bookhub.tech/rest_apis/data_stream_apis/promote_data_stream)
923923
- :heavy_check_mark: 修改数据流 [:link:](https://elasticsearch.bookhub.tech/rest_apis/data_stream_apis/modify_data_stream)
924924
- :heavy_check_mark: 设置数据流生命周期 [:link:](https://elasticsearch.bookhub.tech/rest_apis/data_stream_apis/put_data_stream_lifecycle)
925+
- :heavy_check_mark: 获取数据流的生命周期 [:link:](https://elasticsearch.bookhub.tech/rest_apis/data_stream_apis/get_data_stream_lifecycle)
925926
- :heavy_check_mark: 文档 API [:link:](https://elasticsearch.bookhub.tech/rest_apis/document_apis/)
926927
- :heavy_check_mark: 读写 API [:link:](https://elasticsearch.bookhub.tech/rest_apis/document_apis/replication)
927928
- :heavy_check_mark: 索引 API [:link:](https://elasticsearch.bookhub.tech/rest_apis/document_apis/docs_index)
Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# 获取数据流的生命周期
2+
3+
获取一组[数据流](/data-streams)[生命周期](/data-streams/data-stream-lifecycle)
4+
5+
## 前置条件
6+
7+
- 如果 Elasticsearch 安全特性启用,你使用此 API 必须有 `manage` [索引权限](/secure_the_elastic_statck/user_authorization/security_privileges#索引权限)`manage_data_stream_lifecycle` 索引权限或 `view_index_metadata` 索引权限。更多信息,参阅[安全权限](/secure_the_elastic_statck/user_authorization/security_privileges)
8+
9+
## 请求
10+
11+
`GET _data_stream/<data-stream>/_lifecycle`
12+
13+
## 描述
14+
15+
获取指定数据流的生命周期。如果请求多个数据流,但其中至少有一个不存在,那么 API 将以 404 响应,因为至少有一个请求的资源无法检索。如果请求的数据流没有配置生命周期,它们仍将包含在 API 响应中,但 `lifecycle` 关键字将丢失。
16+
17+
## 路径参数
18+
19+
- `<data-stream>`
20+
21+
(必需,字符串) 用于限制请求的数据流的逗号分隔列表。支持通配符 (`*`)。要针对所有数据流,请使用 `*``_all`
22+
23+
## 查询参数
24+
25+
- `expand_wildcards`
26+
27+
(可选,字符串)通配符模式可以匹配的数据流类型。支持逗号分隔值,例如 `open,hidden`。有效值为:
28+
29+
- `all``hidden`
30+
31+
匹配任何数据流或索引,包括[隐藏的](/rest_apis/api_conventions/multi_target_syntax#隐藏数据流和索引)。
32+
33+
- `open``closed`
34+
35+
匹配任何非隐藏的数据流。无法关闭 Data Streams。
36+
37+
- `none`
38+
39+
不接受通配符模式。
40+
41+
默认为 `open`
42+
43+
- `include_defaults`
44+
45+
(可选,布尔值) 如果为 `true`,则在响应中返回所有默认设置。默认为 `false`
46+
47+
## 响应体
48+
49+
- `data_streams`
50+
51+
(对象数组)包含有关检索到的数据流生命周期的信息。
52+
53+
- `data_streams` 对象属性
54+
55+
- `name`
56+
57+
(字符串) 数据流的名称。
58+
59+
- `lifecycle`
60+
61+
(可选,对象)
62+
63+
`lifecycle` 属性
64+
65+
- `data_retention`
66+
67+
(可选,字符串) 如果已定义,则表示数据流所有者为该数据流要求的保留时间。
68+
69+
- `effective_retention`
70+
71+
(可选,字符串)如果定义,则添加到此数据流中的每个文档都将至少在此时间段内保存。在此期限之后的任何时间,文档都可能被删除。如果为空,该数据流中的每份文档都将无限期存储。为空时,该数据流中的每份文档都将无限期保存。有效保留时间的计算方法如[教程](/data_streams/data_stream_lifecycle/tutorial_data_stream_retention#如何计算有效保留时间?)所述。
72+
73+
- `retention_determined_by`
74+
75+
(可选,字符串) 保留的来源,可以是三种值之一:`data_stream_configuration`、`default_retention` 或 `max_retention`。
76+
77+
- `rollover`
78+
79+
(可选,对象)由集群设置 `cluster.lifecycle.default.rollover` 配置的触发后备索引翻转的条件。该属性是一个实现细节,只有当查询参数 `include_defaults` 设置为 `true` 时才能检索到。此字段的内容可能会更改。
80+
81+
- `global_retention`
82+
83+
(对象)包含全局最大保留和默认保留。如果未配置全局保留,则该对象为空。
84+
85+
- `global_retention` 属性
86+
87+
- `max_retention`
88+
89+
(可选,字符串) 数据流生命周期管理的数据流的有效保留时间不能超过此值。
90+
91+
- `default_retention`
92+
93+
(可选,字符串) 这将是数据流生命周期管理的、未指定 `data_retention` 的数据流的有效保留时间。
94+
95+
## 示例
96+
97+
让我们检索生命周期:
98+
99+
```bash
100+
GET _data_stream/my-data-stream*/_lifecycle
101+
```
102+
103+
响应如下:
104+
105+
```json
106+
{
107+
"data_streams": [
108+
{
109+
"name": "my-data-stream-1",
110+
"lifecycle": {
111+
"enabled": true,
112+
"data_retention": "7d",
113+
"effective_retention": "7d",
114+
"retention_determined_by": "data_stream_configuration"
115+
}
116+
},
117+
{
118+
"name": "my-data-stream-2",
119+
"lifecycle": {
120+
"enabled": true,
121+
"data_retention": "7d",
122+
"effective_retention": "7d",
123+
"retention_determined_by": "data_stream_configuration"
124+
}
125+
}
126+
],
127+
"global_retention": {}
128+
}
129+
```
130+
131+
> [原文链接](https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams-get-lifecycle.html)

docusaurus.config.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,7 @@ const config = {
131131
href: 'https://pac4j.bookhub.tech',
132132
}
133133
],
134-
},
135-
{
136-
title: '更多',
137-
items: [
138-
{
139-
label: '计算机书库',
140-
href: 'https://pdf.bookhub.tech',
141-
}
142-
],
143-
},
134+
}
144135
],
145136
copyright: `Copyright © ${new Date().getFullYear()} bookHub.tech`,
146137
},

sidebars.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ const sidebars = {
163163
'rest_apis/data_stream_apis/data_stream_stats',
164164
'rest_apis/data_stream_apis/promote_data_stream',
165165
'rest_apis/data_stream_apis/modify_data_stream',
166-
'rest_apis/data_stream_apis/put_data_stream_lifecycle'
166+
'rest_apis/data_stream_apis/put_data_stream_lifecycle',
167+
'rest_apis/data_stream_apis/get_data_stream_lifecycle',
167168
]
168169
},
169170
{

0 commit comments

Comments
 (0)