How to Index an Array as Field names

Is there a way to Index an Object in this format, for example,

[Name, Phone, Address]

It can be multiple positions aswell, not exactly these three

And put in a Index using the javascript API like this:{
          index: 'name_of_index',
          type: 'type_of_index', 
          body: {
            title: form.value.title,
             description: form.value.description,
             published: new Date().toLocaleString(),
             script: this.alternativeFields.value,

Basically this Array can be anything, I've tried several things, like using javascript eval, but none of these tries worked, also, didn't find any elastic function that allows me to do that, please help.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.