Skip to content

Commit

Permalink
Added ES 5 support
Browse files Browse the repository at this point in the history
  • Loading branch information
taraslayshchuk committed Feb 15, 2017
1 parent d5c1e44 commit 8e1eab4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions es2csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def next_scroll(scroll_id):
return self.es_conn.scroll(scroll=self.scroll_time, scroll_id=scroll_id)
search_args = dict(
index=','.join(self.opts.index_prefixes),
search_type='scan',
scroll=self.scroll_time,
size=self.scroll_size,
terminate_after=self.opts.max_results
Expand Down Expand Up @@ -134,7 +133,6 @@ def next_scroll(scroll_id):

res = self.es_conn.search(**search_args)

self.scroll_ids.append(res['_scroll_id'])
self.num_results = res['hits']['total']

print('Found %s results' % self.num_results)
Expand All @@ -159,7 +157,6 @@ def next_scroll(scroll_id):
bar = progressbar.ProgressBar(widgets=widgets, maxval=self.num_results).start()

while total_lines != self.num_results:
res = next_scroll(res['_scroll_id'])
if res['_scroll_id'] not in self.scroll_ids:
self.scroll_ids.append(res['_scroll_id'])

Expand All @@ -178,6 +175,7 @@ def next_scroll(scroll_id):
self.flush_to_file(hit_list)
print('Hit max result limit: %s records' % self.opts.max_results)
return
res = next_scroll(res['_scroll_id'])
self.flush_to_file(hit_list)
bar.finish()

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
elasticsearch>=2.4.0,<2.5.0
elasticsearch>=5.2.0,<5.3.0
progressbar2>=3.10.0,<3.11.0

0 comments on commit 8e1eab4

Please sign in to comment.