Skip to content

Commit

Permalink
feat: rollup init template update (#98)
Browse files Browse the repository at this point in the history
Co-authored-by: hardy <[email protected]>
  • Loading branch information
luohoufu and luohf-infinilabs authored Jan 23, 2025
1 parent 52dee9c commit 67447b8
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 36 deletions.
127 changes: 92 additions & 35 deletions config/setup/easysearch/template_rollup.tpl
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
PUT /.easysearch-ilm-config/_settings
{
"index": {
"mapping": {
"nested_fields": {
"limit": 1000
},
"nested_objects": {
"limit": 20000
},
"total_fields": {
"limit": 30000
}
}
}
}

DELETE _rollup/jobs/rollup_index_stats
PUT _rollup/jobs/rollup_index_stats?replace
DELETE /_rollup/jobs/rollup_index_stats
PUT /_rollup/jobs/rollup_index_stats
{
"rollup": {
"source_index": ".infini_metrics",
Expand All @@ -30,6 +13,9 @@ PUT _rollup/jobs/rollup_index_stats?replace
{
"max": {}
},
{
"min": {}
},
{
"value_count": {}
}
Expand All @@ -56,8 +42,8 @@ PUT _rollup/jobs/rollup_index_stats?replace
}
}

DELETE _rollup/jobs/rollup_index_health
PUT _rollup/jobs/rollup_index_health?replace
DELETE /_rollup/jobs/rollup_index_health
PUT /_rollup/jobs/rollup_index_health
{
"rollup": {
"source_index": ".infini_metrics",
Expand Down Expand Up @@ -96,8 +82,8 @@ PUT _rollup/jobs/rollup_index_health?replace
}
}

DELETE _rollup/jobs/rollup_cluster_stats
PUT _rollup/jobs/rollup_cluster_stats?replace
DELETE /_rollup/jobs/rollup_cluster_stats
PUT /_rollup/jobs/rollup_cluster_stats
{
"rollup": {
"source_index": ".infini_metrics",
Expand Down Expand Up @@ -136,8 +122,8 @@ PUT _rollup/jobs/rollup_cluster_stats?replace
}
}

DELETE _rollup/jobs/rollup_cluster_health
PUT _rollup/jobs/rollup_cluster_health?replace
DELETE /_rollup/jobs/rollup_cluster_health
PUT /_rollup/jobs/rollup_cluster_health
{
"rollup": {
"source_index": ".infini_metrics",
Expand Down Expand Up @@ -175,16 +161,15 @@ PUT _rollup/jobs/rollup_cluster_health?replace
}
}

# 高级 节点
DELETE _rollup/jobs/rollup_node_stats
PUT _rollup/jobs/rollup_node_stats?replace
DELETE /_rollup/jobs/rollup_node_stats
PUT /_rollup/jobs/rollup_node_stats
{
"rollup": {
"source_index": ".infini_metrics",
"target_index": "rollup_node_stats_{{ctx.source_index}}",
"timestamp": "timestamp",
"continuous": true,
"page_size": 100,
"page_size": 200,
"cron": "*/10 1-23 * * *",
"timezone": "UTC",
"stats": [
Expand All @@ -198,6 +183,42 @@ PUT _rollup/jobs/rollup_node_stats?replace
"value_count": {}
}
],
"special_metrics": [
{
"source_field": "payload.elasticsearch.node_stats.process.cpu.percent",
"metrics": [
{
"avg": {}
},
{
"max": {}
},
{
"min": {}
},
{
"percentiles": {}
}
]
},
{
"source_field": "payload.elasticsearch.node_stats.jvm.mem.heap_used_in_bytes",
"metrics": [
{
"avg": {}
},
{
"max": {}
},
{
"min": {}
},
{
"percentiles": {}
}
]
}
],
"interval": "1m",
"identity": [
"metadata.labels.cluster_id",
Expand All @@ -222,21 +243,24 @@ PUT _rollup/jobs/rollup_node_stats?replace
}
}

DELETE _rollup/jobs/rollup_shard_stats_metrics
PUT _rollup/jobs/rollup_shard_stats_metrics?replace
DELETE /_rollup/jobs/rollup_shard_stats_metrics
PUT /_rollup/jobs/rollup_shard_stats_metrics
{
"rollup": {
"source_index": ".infini_metrics",
"target_index": "rollup_shard_stats_metrics_{{ctx.source_index}}",
"timestamp": "timestamp",
"continuous": true,
"page_size": 100,
"page_size": 200,
"cron": "*/5 1-23 * * *",
"timezone": "UTC",
"stats": [
{
"max": {}
},
{
"min": {}
},
{
"value_count": {}
}
Expand Down Expand Up @@ -265,8 +289,8 @@ PUT _rollup/jobs/rollup_shard_stats_metrics?replace
}
}

DELETE _rollup/jobs/rollup_shard_stats_state
PUT _rollup/jobs/rollup_shard_stats_state?replace
DELETE /_rollup/jobs/rollup_shard_stats_state
PUT /_rollup/jobs/rollup_shard_stats_state
{
"rollup": {
"source_index": ".infini_metrics",
Expand Down Expand Up @@ -301,4 +325,37 @@ PUT _rollup/jobs/rollup_shard_stats_state?replace
"metadata.name": "shard_stats"
}
}
}
}

# enable rollup search
PUT /_cluster/settings
{
"persistent": {
"rollup": {
"search": {
"enabled": "true"
}
}
}
}

# update index settings
PUT /.easysearch-ilm-config/_settings
{
"index": {
"mapping": {
"nested_fields": {
"limit": 1000
},
"nested_objects": {
"limit": 20000
},
"total_fields": {
"limit": 30000
}
}
}
}

# start all rollup jobs
POST /_rollup/jobs/rollup*/_start
2 changes: 1 addition & 1 deletion plugin/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ func (module *Module) initializeTemplate(w http.ResponseWriter, r *http.Request,
elastic2.InitTemplate(true)
case "rollup":
if ver.Distribution == elastic.Easysearch {
if large, _ := util.VersionCompare(ver.Number, "1.9.2"); large > 0 {
if large, _ := util.VersionCompare(ver.Number, "1.10.0"); large > 0 {
useCommon = false
dslTplFileName = "template_rollup.tpl"
}
Expand Down

0 comments on commit 67447b8

Please sign in to comment.