Fixed _doc to doc in record
This commit is contained in:
parent
c6204be8e1
commit
510f7db07e
@ -127,21 +127,21 @@ async def process_data(file_path: str):
|
|||||||
|
|
||||||
# Check if we are still processing the same domain
|
# Check if we are still processing the same domain
|
||||||
if last:
|
if last:
|
||||||
if domain == last['domain']: # This record is for the same domain as the cached document
|
if domain == last['doc']['domain']:
|
||||||
if record_type in last['_doc']['records']:
|
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?
|
last['doc']['records'][record_type].append({'ttl': ttl, 'data': data}) # Do we need to check for duplicate records?
|
||||||
else:
|
else:
|
||||||
last['_doc']['records'][record_type] = [{'ttl': ttl, 'data': data}]
|
last['doc']['records'][record_type] = [{'ttl': ttl, 'data': data}]
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
yield last # Return the last document and start a new one
|
yield last
|
||||||
|
|
||||||
# Cache the document
|
# Cache the document
|
||||||
last = {
|
last = {
|
||||||
'_op_type' : 'update',
|
'_op_type' : 'update',
|
||||||
'_id' : domain,
|
'_id' : domain,
|
||||||
'_index' : default_index,
|
'_index' : default_index,
|
||||||
'_doc' : {
|
'doc' : {
|
||||||
'domain' : domain,
|
'domain' : domain,
|
||||||
'zone' : zone,
|
'zone' : zone,
|
||||||
'records' : {record_type: [{'data': data, 'ttl': ttl}]},
|
'records' : {record_type: [{'data': data, 'ttl': ttl}]},
|
||||||
|
Loading…
Reference in New Issue
Block a user