-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathES_IndexInit.sh
executable file
·54 lines (47 loc) · 1.01 KB
/
ES_IndexInit.sh
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
ESHOST="http://localhost:9200"
ESCREDENTIALS="-u elastic:passwordhere"
# deletes and recreates a status index with a bespoke schema
curl $ESCREDENTIALS -s -XDELETE "$ESHOST/status/" > /dev/null
echo "Deleted status index"
# http://localhost:9200/status/_mapping/status?pretty
echo "Creating status index with mapping"
curl $ESCREDENTIALS -s -XPUT $ESHOST/status -H 'Content-Type: application/json' -d '
{
"settings": {
"index": {
"number_of_shards": 10,
"number_of_replicas": 1,
"refresh_interval": "5s"
}
},
"mappings": {
"dynamic_templates": [{
"metadata": {
"path_match": "metadata.*",
"match_mapping_type": "string",
"mapping": {
"type": "keyword"
}
}
}],
"_source": {
"enabled": true
},
"properties": {
"key": {
"type": "keyword",
"index": true
},
"nextFetchDate": {
"type": "date",
"format": "date_optional_time"
},
"status": {
"type": "keyword"
},
"url": {
"type": "keyword"
}
}
}
}'