Skip to content

Commit

Permalink
refactor: Optimize index source retrieval in Wazuh-Indexer
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorwalton committed Sep 18, 2024
1 parent d002ed8 commit 06384ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions backend/app/connectors/wazuh_indexer/utils/universal.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,7 @@ async def get_index_source(index_name: str):
}
}
}
response = await es_client.search(index=index_name, body=query_syslog_type)
response = es_client.search(index=index_name, body=query_syslog_type)
for hit in response["hits"]["hits"]: # Loop through each hit in the response
if "syslog_type" in hit["_source"]: # Check if 'syslog_type' exists in the source of the hit
if hit["_source"]["syslog_type"] == "integration" and "integration" in hit["_source"]:
Expand All @@ -556,7 +556,7 @@ async def get_index_source(index_name: str):
}
}
}
response = await es_client.search(index=index_name, body=query_integration)
response = es_client.search(index=index_name, body=query_integration)
for hit in response["hits"]["hits"]: # Loop through each hit in the response
if "integration" in hit["_source"]: # Check if 'integration' exists in the source of the hit
return hit["_source"]["integration"] # Return the value of 'integration'
Expand Down

0 comments on commit 06384ef

Please sign in to comment.