Hi everybody,
I want to create an Index in Elasticsearch using Javascript. The name of
each column is 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:
client.index(
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.
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/d6a3dcf4-245a-491a-b94c-79bdf4826698%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.