'from excel with grouped rows to elasticsearch (using python to create the index)

Having an excel with grouped rows (as in the picture), for this data Test1, Test2 and Test3 are the main tasks, and the other lines are subtasks, I would like to have the same format on elasticsearch (using python to create the index). link for the picture

json_str = generate_data(df_test).to_json(orient='records', date_format='iso')

json_records = json.loads(json_str)

action_list=[]
for row in json_records:
    record ={
        '_op_type': 'index',
        '_index': index_name,
        '_source': row
    }
    action_list.append(record)

helpers.bulk(es, action_list)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source