Skip to content

Commit

Permalink
add an optional host param on load.py
Browse files Browse the repository at this point in the history
If you want/need to load data into a different es cluster just specify the -H/--host option

ex: python load.py --host http://123.123.123.123:9200
  • Loading branch information
fxdgear committed Jun 14, 2017
1 parent d67c483 commit cd8e588
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion example/load.py
Expand Up @@ -6,6 +6,7 @@
from datetime import datetime
import logging
import sys
import argparse

import git

Expand Down Expand Up @@ -174,8 +175,16 @@ def load_repo(client, path=None, index='git'):
tracer.setLevel(logging.INFO)
tracer.addHandler(logging.FileHandler('/tmp/es_trace.log'))

parser = argparse.ArgumentParser()
parser.add_argument(
"-H", "--host",
action="store",
default="localhost:9200",
help="The elasticsearch host you wish to connect too. (Default: localhost:9200)")
args = parser.parse_args()

# instantiate es client, connects to localhost:9200 by default
es = Elasticsearch()
es = Elasticsearch(args.host)

# we load the repo and all commits
load_repo(es, path=sys.argv[1] if len(sys.argv) == 2 else None)
Expand Down

0 comments on commit cd8e588

Please sign in to comment.