Fixed _doc to doc in record

This commit is contained in:
Dionysus 2024-03-23 17:26:55 -04:00
parent c6204be8e1
commit 510f7db07e
Signed by: acidvegas
GPG Key ID: EF4B922DB85DC9DE

View File

@ -127,21 +127,21 @@ async def process_data(file_path: str):
# Check if we are still processing the same domain
if last:
if domain == last['domain']: # This record is for the same domain as the cached document
if record_type in last['_doc']['records']:
last['_doc']['records'][record_type].append({'ttl': ttl, 'data': data}) # Do we need to check for duplicate records?
if domain == last['doc']['domain']:
if record_type in last['doc']['records']:
last['doc']['records'][record_type].append({'ttl': ttl, 'data': data}) # Do we need to check for duplicate records?
else:
last['_doc']['records'][record_type] = [{'ttl': ttl, 'data': data}]
last['doc']['records'][record_type] = [{'ttl': ttl, 'data': data}]
continue
else:
yield last # Return the last document and start a new one
yield last
# Cache the document
last = {
'_op_type' : 'update',
'_id' : domain,
'_index' : default_index,
'_doc' : {
'doc' : {
'domain' : domain,
'zone' : zone,
'records' : {record_type: [{'data': data, 'ttl': ttl}]},