Sorting for Search Index
Some checks are pending
gl/check check status: pending (7e2761dc32b24462c86588c9900061a77c705e7c)
Some checks are pending
gl/check check status: pending (7e2761dc32b24462c86588c9900061a77c705e7c)
This commit is contained in:
@ -78,6 +78,9 @@ def main():
|
|||||||
all_doc_types=args.all_doc_types
|
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")
|
logging.debug("Indexing data into OpenSearch")
|
||||||
indexData(
|
indexData(
|
||||||
deleteIndex=args.delete_index,
|
deleteIndex=args.delete_index,
|
||||||
@ -85,7 +88,7 @@ def main():
|
|||||||
index=args.index,
|
index=args.index,
|
||||||
username=args.username,
|
username=args.username,
|
||||||
password=args.password,
|
password=args.password,
|
||||||
data=data
|
data=sorted_data
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -105,6 +108,8 @@ def getData(environment, all_doc_types):
|
|||||||
final_data = filter_docs(metadatadata)
|
final_data = filter_docs(metadatadata)
|
||||||
return final_data
|
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):
|
def indexData(deleteIndex, hosts, index, username, password, data):
|
||||||
hosts = generate_os_host_list(hosts)
|
hosts = generate_os_host_list(hosts)
|
||||||
|
Reference in New Issue
Block a user