-
Notifications
You must be signed in to change notification settings - Fork 0
/
CreateIndex.py
32 lines (22 loc) · 964 Bytes
/
CreateIndex.py
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
import sys
import os
import xmlHandler
import elasticsearchHandler
import argparse
import json
import glob
from elasticsearchHandler import elasticSearchHandler
def createDataStructure(server, port, idx, MappingsFile):
elasticHandler = elasticSearchHandler(server, port)
# elasticHandler = elasticSearchHandler(server,port)
settingsfile = open(MappingsFile, "r")
settings = settingsfile.read()
elasticHandler.createIndex(idx, settings)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('server', help='Ipaddress or logicalname for elastic server')
parser.add_argument('port', help='portnr for server')
parser.add_argument('indeksName', help='Navn på indeks')
parser.add_argument('definisjonsfil', help='Fil med definisjoner for layout')
args = parser.parse_args()
createDataStructure(args.server, args.port, args.indeksName, args.definisjonsfil)