Skip to content

Commit

Permalink
Merge pull request #86 from sephcoster/no5k
Browse files Browse the repository at this point in the history
Reverting 5k limit to Unlimited
  • Loading branch information
sephcoster authored Dec 11, 2018
2 parents 18b9f70 + e8b2ffd commit 26cde7e
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions complaint_search/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ElasticSearchExporter(object):
# - header_dict (OrderedDict)
# The ordered dictionary where the key is the Elasticsearch field name
# and the value is the CSV column header for that field
def export_csv(self, scanResponse, header_dict, max_size=5000):
def export_csv(self, scanResponse, header_dict):
def read_and_flush(writer, buffer_, row):
writer.writerow(row)
buffer_.seek(0)
Expand All @@ -47,10 +47,7 @@ def stream():
count = 0
# Write CSV
for row in scanResponse:
if count >= max_size:
break
else:
count += 1
count += 1
rows_data = {key: unicode(value) for key, value in row['_source'].iteritems()
if key in header_dict.keys()}

Expand All @@ -68,16 +65,13 @@ def stream():
#
# Parameters:
# - scanResponse (generator)
# The response from an Elasticsaerch scan query
def export_json(self, scanResponse, max_size=5000):
# The response from an Elasticsearch scan query
def export_json(self, scanResponse):
def stream():
count = 0
# Write JSON
for row in scanResponse:
if count >= max_size:
break
else:
count += 1
count += 1
yield json.dumps(row)

response = StreamingHttpResponse(
Expand Down

0 comments on commit 26cde7e

Please sign in to comment.