Newer
Older
Alessandro Cerioni
committed
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
if __name__ == '__main__':
import yaml
with open("config.yaml", 'r') as yamlfile:
cfg = yaml.load(yamlfile)
es = Elasticsearch([cfg['indexer']['url']], timeout=60)
es_index = cfg['indexer']['index']
es_body = { "settings" : {
"number_of_shards" : 1,
"number_of_replicas" : 0,
"index.mapping.total_fields.limit": 10000,
"refresh_interval": "30s"
},
"mappings": {
"_doc": {
"dynamic_templates": [ # priority is given by order!
{
"uuid" : {
"path_match": "uuid",
"mapping": {
"type": "keyword",
}
}
},
{
"default" : {
"path_match": "*",
"mapping": {
"enabled": "false"
}
}
}
]
}
}
}
#es_body.update({"mappings": {"_doc": {"dynamic_date_formats": ["strict_date_optional_time"]}}})
try:
rep = es.indices.create(es_index, es_body)#, wait_for_active_shards=0)
except:
pass