# Analyzed tokens to array on document

**URL:** https://discuss.elastic.co/t/analyzed-tokens-to-array-on-document/179052
**Category:** Elasticsearch
**Created:** [April 30, 2019, 9:32am UTC](https://discuss.elastic.co/t/analyzed-tokens-to-array-on-document/179052 "2019-04-30T09:32:12Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Jochen](https://avatars.discourse-cdn.com/v4/letter/j/91b2a8/32.png) [@Jochen](https://discuss.elastic.co/u/Jochen)
#### Post date: [April 30, 2019, 9:32am UTC](https://discuss.elastic.co/t/analyzed-tokens-to-array-on-document/179052/1 "2019-04-30T09:32:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [May 28, 2019, 9:32am UTC](https://discuss.elastic.co/t/analyzed-tokens-to-array-on-document/179052/2 "2019-05-28T09:32:14Z")

</div>

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