Analyzed tokens to array on document

Good morning,

I am trying to create an index with products where I need to store keywords for each individual product.

I am using an analyzer to create tokens for each product description (It is a standard analyzer with some token and charfilters). Is there a way to map these tokens to an array on my document at index time?

Let's say for example, I have a document

{
"product-decription" : "A book case"
}

When I add this document to my index, I want to get the following result:

{
"product-description": "A book case"
"keywords": ["book", "case"]
}

What I am doing now is:

  • Call the _analyze endpoint for every description to get the tokens, add them to the keywords array and then add the document to the index.

I was wondering if it's possible to define this in an analyzer, or if there is an alternative method than calling the _analyze endpoint for each product?

Thanks in advance.
Jochen

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