Skip to content

Commit f86e4e3

Browse files
committed
add get_data_stream_lifecycle_state,downsample
1 parent 4059939 commit f86e4e3

File tree

5 files changed

+148
-2
lines changed

5 files changed

+148
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,8 @@ npm run docs:dev
925925
- :heavy_check_mark: 获取数据流的生命周期 [:link:](https://elasticsearch.bookhub.tech/rest_apis/data_stream_apis/get_data_stream_lifecycle)
926926
- :heavy_check_mark: 删除数据流的生命周期 [:link:](https://elasticsearch.bookhub.tech/rest_apis/data_stream_apis/delete_data_stream_lifecycle)
927927
- :heavy_check_mark: 解释数据流的生命周期 [:link:](https://elasticsearch.bookhub.tech/rest_apis/data_stream_apis/explain_data_stream_lifecycle)
928+
- :heavy_check_mark: 获取数据流生命周期统计信息 [:link:](https://elasticsearch.bookhub.tech/rest_apis/data_stream_apis/get_data_stream_lifecycle_state)
929+
- :heavy_check_mark: 下采样 [:link:](https://elasticsearch.bookhub.tech/rest_apis/data_stream_apis/downsample)
928930
- :heavy_check_mark: 文档 API [:link:](https://elasticsearch.bookhub.tech/rest_apis/document_apis/)
929931
- :heavy_check_mark: 读写 API [:link:](https://elasticsearch.bookhub.tech/rest_apis/document_apis/replication)
930932
- :heavy_check_mark: 索引 API [:link:](https://elasticsearch.bookhub.tech/rest_apis/document_apis/docs_index)

docs/rest_apis/data_stream_apis/data_stream_apis.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
- [获取数据流生命周期](./get_data_stream_lifecycle) [预览版]
2121
- [删除数据流生命周期](./delete_data_stream_lifecycle) [预览版]
2222
- [解释数据流生命周期](./explain_data_stream_lifecycle) [预览版]
23-
- [获取数据流生命周期统计数据](./get_data_stream_lifecycle)[预览版]
23+
- [获取数据流生命周期统计数据](./get_data_stream_lifecycle_state)[预览版]
2424

2525
以下 API 可用于[时序数据流](/data_streams/tsds)
2626

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# 下采样索引 API
2+
3+
:::info 新 API 参考
4+
有关最新 API 的详细信息,参阅[数据流 API](https://www.elastic.co/docs/api/doc/elasticsearch/v8/group/endpoint-data-stream)
5+
:::
6+
7+
聚合时间序列 (TSDS) 索引,并存储按配置时间间隔分组的每个指标字段的预计算统计摘要(`min``max``sum``value_count``avg`)。例如,包含每 10 秒采样一次的指标的 TSDS 索引可以缩减采样为每小时索引。一小时间隔内的所有文档都会汇总并作为单个文档存储在下采样索引中。
8+
9+
```bash
10+
POST /my-time-series-index/_downsample/my-downsampled-time-series-index
11+
{
12+
"fixed_interval": "1d"
13+
}
14+
```
15+
16+
请查阅[下采样](/data_streams/tsds/downsamping_a_time_series_data_stream)文档,了解概述、向下采样过程的详情以及手动运行向下采样和作为 ILM 策略的一部分运行向下采样的示例。
17+
18+
## 请求
19+
20+
`POST /<source-index>/_downsample/<output-downsampled-index>`
21+
22+
## 前置条件
23+
24+
- 仅支持[时序数据流](/data_streams/tsds)中的索引。
25+
- 如果启用了 Elasticsearch 安全功能,则必须拥有数据流的 `all``manage` [索引权限](/secure_the_elastic_statck/user_authorization/security_privileges#索引权限)
26+
- 源索引上不能[定义字段或文档级安全性](/secure_the_elastic_statck/user_authorization/setting_up_field_and_document_level_security)
27+
- 源索引必须是只读的(`index.blocks.write: true`)。
28+
29+
## 路径参数
30+
31+
- `<source-index>`
32+
33+
(可选,字符串)要进行下采样的时间序列索引名称。
34+
35+
- `<output-downsampled_index>`
36+
37+
(必须,字符串) 要创建的索引的名称。
38+
39+
- 只能是小写字符
40+
- 不能包含字符:`\``/``*``?``"``<``>``|`` `(空格)、`,``#`
41+
- 7.0 之前索引可以包含冒号(:),但在 7.0 之后不推荐。
42+
- 不能以 `-``_``+` 开头
43+
- 不能是 `.``..`
44+
- 长度不能超过 255 字节(注意是字节,所以多字节字符会更快达到 255 的限制)
45+
- 名字以 `.` 开头不推荐,除非由插件管理的[隐藏索引](/index_modules)和内部索引
46+
47+
## 查询参数
48+
49+
- `fixed_interval`
50+
51+
(必填,[时间单位](/rest_apis/api_convention/common_options#时间单位))汇总原始时间序列索引的时间间隔。例如,60m 为每个 60 分钟(每小时)间隔生成一个文档。这遵循 Elasticsearch 中其他地方使用的标准时间格式语法。
52+
53+
:::note 提示
54+
更小、更细的区间所占空间也更大。
55+
:::
56+
57+
> [原文链接](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-downsample-data-stream.html)
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# 获取数据流生命周期统计信息
2+
3+
:::info 新 API 参考
4+
有关最新 API 的详细信息,参阅[数据流 API](https://www.elastic.co/docs/api/doc/elasticsearch/v8/group/endpoint-data-stream)
5+
:::
6+
7+
获取有关[数据流生命周期](/data_streams/data_stream_lifecycle)执行情况的统计信息。
8+
9+
## 前置条件
10+
11+
- 如果 Elasticsearch 安全特性启用,你必须有 `monitor``manage` [集群权限](/secure_the_elastic_statck/user_authorization/security_privileges#集群权限)来使用此 API。
12+
13+
## 请求
14+
15+
`GET _lifecycle/stats`
16+
17+
## 描述
18+
19+
获取有关数据流生命周期执行情况的统计信息。数据流级别的统计信息只包括数据流生命周期管理的数据流的统计信息。
20+
21+
## 响应体
22+
23+
- `last_run_duration_in_millis`
24+
25+
(可选,长整数)最后一次执行数据流生命周期的持续时间。
26+
27+
- `time_between_starts_in_millis`
28+
29+
(可选,长整数)最后两次数据流生命周期执行开始之间的时间间隔。该值应近似于 [`data_streams.lifecycle.poll_interval`](/set_up_elasticsearch/configuring_elasticsearch/data_stream_lifecycle_settings)
30+
31+
- `data_stream_count`
32+
33+
(整数) 当前由数据流生命周期管理的数据流的计数。
34+
35+
- `data_streams`
36+
37+
(对象数组)包含检索到的数据流生命周期的相关信息。
38+
39+
- `data_streams` 中的对象属性
40+
41+
- `name`
42+
43+
(字符串) 数据流的名称。
44+
45+
- `backing_indices_in_total`
46+
47+
(整数)由数据流生命周期管理的该数据流后备索引的计数。
48+
49+
- `backing_indices_in_error`
50+
51+
(整数)由数据流生命周期管理并已遇到错误的数据流后备索引的计数。
52+
53+
## 示例
54+
55+
让我们检索已执行过一次以上生命周期的群集的数据流生命周期统计信息:
56+
57+
```bash
58+
GET _lifecycle/stats?human&pretty
59+
```
60+
61+
回复内容如下
62+
63+
```json
64+
{
65+
"last_run_duration_in_millis": 2,
66+
"last_run_duration": "2ms",
67+
"time_between_starts_in_millis": 9998,
68+
"time_between_starts": "9.99s",
69+
"data_streams_count": 2,
70+
"data_streams": [
71+
{
72+
"name": "my-data-stream",
73+
"backing_indices_in_total": 2,
74+
"backing_indices_in_error": 0
75+
},
76+
{
77+
"name": "my-other-stream",
78+
"backing_indices_in_total": 2,
79+
"backing_indices_in_error": 1
80+
}
81+
]
82+
}
83+
```
84+
85+
> [原文链接](https://www.elastic.co/guide/en/elasticsearch/reference/current/data-streams-get-lifecycle-stats.html)

sidebars.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ const sidebars = {
166166
'rest_apis/data_stream_apis/put_data_stream_lifecycle',
167167
'rest_apis/data_stream_apis/get_data_stream_lifecycle',
168168
'rest_apis/data_stream_apis/delete_data_stream_lifecycle',
169-
'rest_apis/data_stream_apis/explain_data_stream_lifecycle'
169+
'rest_apis/data_stream_apis/explain_data_stream_lifecycle',
170+
'rest_apis/data_stream_apis/get_data_stream_lifecycle_state',
171+
'rest_apis/data_stream_apis/downsample'
170172
]
171173
},
172174
{

0 commit comments

Comments
 (0)