Sorting for Search Index
Some checks are pending
gl/check check status: pending (7e2761dc32b24462c86588c9900061a77c705e7c)

This commit is contained in:
2023-08-25 08:16:16 +00:00
parent 4cf33fc15b
commit 7e2761dc32

View File

@ -78,6 +78,9 @@ def main():
all_doc_types=args.all_doc_types
)
sorted_services = sortData(data['services'], sort_key='service_title')
sorted_data = {'services': sorted_services, 'docs': data['docs']}
logging.debug("Indexing data into OpenSearch")
indexData(
deleteIndex=args.delete_index,
@ -85,7 +88,7 @@ def main():
index=args.index,
username=args.username,
password=args.password,
data=data
data=sorted_data
)
@ -105,6 +108,8 @@ def getData(environment, all_doc_types):
final_data = filter_docs(metadatadata)
return final_data
def sortData(data, sort_key):
return sorted(data, key=lambda x: x[sort_key])
def indexData(deleteIndex, hosts, index, username, password, data):
hosts = generate_os_host_list(hosts)