This repository was archived by the owner on Jul 8, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathES_IndexInit.sh
More file actions
executable file
·72 lines (64 loc) · 1.6 KB
/
ES_IndexInit.sh
File metadata and controls
executable file
·72 lines (64 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
ESHOST="http://localhost:9200"
ESCREDENTIALS="-u elastic:passwordhere"
curl $ESCREDENTIALS -s -XDELETE "$ESHOST/metrics*/" > /dev/null
echo ""
echo "Deleted metrics index"
curl $ESCREDENTIALS -s -XPUT $ESHOST/_ilm/policy/7d-deletion_policy -H 'Content-Type:application/json' -d '
{
"policy": {
"phases": {
"delete": {
"min_age": "7d",
"actions": {
"delete": {}
}
}
}
}
}
'
echo "Creating metrics index with mapping"
# http://localhost:9200/metrics/_mapping/status?pretty
curl $ESCREDENTIALS -s -XPOST $ESHOST/_template/storm-metrics-template -H 'Content-Type: application/json' -d '
{
"index_patterns": "metrics*",
"settings": {
"index": {
"number_of_shards": 1,
"refresh_interval": "30s"
},
"number_of_replicas": 0,
"lifecycle.name": "7d-deletion_policy"
},
"mappings": {
"_source": { "enabled": true },
"properties": {
"name": {
"type": "keyword"
},
"stormId": {
"type": "keyword"
},
"srcComponentId": {
"type": "keyword"
},
"srcTaskId": {
"type": "short"
},
"srcWorkerHost": {
"type": "keyword"
},
"srcWorkerPort": {
"type": "integer"
},
"timestamp": {
"type": "date",
"format": "date_optional_time"
},
"value": {
"type": "double"
}
}
}
}'
curl $ESCREDENTIALS -X PUT $ESHOST/metrics