From e8b2ffd3f867bda7eb8a65bcdcecfb36af424685 Mon Sep 17 00:00:00 2001 From: sephcoster Date: Tue, 11 Dec 2018 09:33:12 -0500 Subject: [PATCH] reverting 5k limit to previous unlimited --- complaint_search/export.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/complaint_search/export.py b/complaint_search/export.py index 795d7f88..712249b8 100644 --- a/complaint_search/export.py +++ b/complaint_search/export.py @@ -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) @@ -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()} @@ -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(