How to Index an array as separate fields in Elasticsearch

Asked

Viewed 36 times

0

I tried to index as follows:

body: {
            name: form.value.name,
            title: form.value.title,
            description: form.value.description,
            published: new Date().toLocaleString(),
            stash: {
              "title": this.alternativeFields.value,
              "type": "object",
              "dynamic": true
            }
          }

Basically this.alternativeFields.value is an array that contains, for example:

["field1", "field2", "field3"]

And for each position of this array, I would like to create a field in the Elastic document.

Is there any way to do this?

  • I don’t get it. You want to save each array value alternativeFields as a separate field? What names will these fields have? Why not save as values within the field title or another?

  • Why these figures will be able to be filled in later.

  • You can fill in the values after rewriting the field or by using Scripted Updates to update list items: https://www.elastic.co/guide/elasticsearch/reference/5.6/docs-update.html#_scripted_updates

  • I’ll take a look, thanks

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.