Last active
September 25, 2016 00:29
-
-
Save leetschau/fa82513bff32efdfb2cb92a2bf0802df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
parser = argparse.ArgumentParser( | |
description='Sync docs in MongoDB to Elasticsearch server') | |
parser.add_argument('inputfile_name', | |
help='the json file contains data to synced from MongoDB') | |
parser.add_argument('-s', '--server-name', | |
help='the IP address of Elasticsearch server') | |
parser.add_argument('-i', '--index', help='the index name of ES') | |
parser.add_argument('-t', '--type-name', help='the type name of the index') | |
parser.add_argument('-e', '--exclude', | |
help='exclude list by the recurrence.timeStart field') | |
args = parser.parse_args() | |
base_url = 'http://%s:%s/%s/%s/' % (args.inputfile_name, args.server_name, args.index, args.type_name) | |
print(base_url) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
inputfile_name
for example) in positional arguments--server-name
for example) in optional arguments