How to take create, using Javascript, an Index in Elasticsearch using a CSV file?

Hi everybody,

Using Javascript, I want to create an Index in Elasticsearch from a csv file.
I put the name of each column (header) in a different position of an array and every field of each
row in another array. How should I "fill" the body of the index? Let's say
a have:

arr_1 = [row1, row2, row3, row4];
arr_2 = [field1, field2, field3, field4];

then I want something like:

index: name_index,
type: name_type,
body: {
row1 : field1; //arr1_[1] : arr_2[1],
row2 : field2; //arr1_[2] : arr_2[2],

My (wrong!!!) solution is more or less:

for (var i = 0; i < arr_1.length; i++){
row = arr_1[i];

field = arr_2[i]:

var bodyContents = {
    row : field         /*this should give me at the end    row1 : field1; //arr1_[1] : arr_2[1],

                                                           row2 : field2; //arr1_[2] : arr_2[2],

..... }; } client.index( { index: index_name, type: type_name, body:
bodyContents }, function (error) { [.....]



Can anyone help me in some way? thanks in advance.