-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Description
Code Sample, a copy-pastable example if possible
Problem description
Create method to export a pandas dataframe data to elasticsearch json format like to_excel, to_csv, to_sql methods.
Input
df : pandas dataframe
index : str : elasticsearch index
type : str : elasticsearch type
EX :
df.head()
Name Age Weight
0 Kevin 26 94
1 Marc 32 70
2 Louis 35 80
index = 'personnes'
type = 'homme'
Usage
df.to_elastic(file_path, 'index'=index, 'type'=type)
Expected Output
{"index":{"_index": "personnes","_type":"homme","_id":1}}
{"fields" : {"Name" : "Kevin","Age" : 26,"Weight" : 94}
{"index" :{"_index": "personnes","_type":"homme","_id":2}}
{"fields" : {"Name" : "Marx","Age" : 32,"Weight" : 70}
{"index" :{"_index": "personnes","_type":"homme","_id":3}}
{"fields" : {"Name" : "Louis","Age" : 35,"Weight" : 80}
Metadata
Metadata
Assignees
Labels
No labels