From 7a3438f38fb74e9edbae698a2e4f04fd31c212fc Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Tue, 12 Nov 2024 09:30:33 -0500 Subject: [PATCH] fix loader --- tests/load_opensearch_data.py | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/tests/load_opensearch_data.py b/tests/load_opensearch_data.py index 3b9e3087b..2c7ab654c 100644 --- a/tests/load_opensearch_data.py +++ b/tests/load_opensearch_data.py @@ -75,30 +75,12 @@ } -def gendata(data): - """ - Generator function to yield features - """ - - for f in data['features']: - try: - f['properties'][id_field] = int(f['properties'][id_field]) - except ValueError: - f['properties'][id_field] = f['properties'][id_field] - yield { - "_index": index_name, - "_id": f['properties'][id_field], - "_source": f - } - - # create index -os_.indices.create( - index=index_name, body=settings) +os_.indices.create(index=index_name, body=settings) with open(sys.argv[1], encoding='utf-8') as fh: d = json.load(fh) for f in d['features']: - os_.index(index=index_name, body=f, id=f['properties']['id'], + os_.index(index=index_name, body=f, id=f['properties'][id_field], refresh=True)