# Copy\_to create array of string

**URL:** <https://discuss.elastic.co/t/copy-to-create-array-of-string/168878>\
**Category:** Elasticsearch\
**Created:** [February 18, 2019, 4:58pm UTC](https://discuss.elastic.co/t/copy-to-create-array-of-string/168878 "2019-02-18T16:58:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![conradoramalho](https://avatars.discourse-cdn.com/v4/letter/c/a9adbd/32.png) [@conradoramalho](https://discuss.elastic.co/u/conradoramalho)\
**Post date:** [February 18, 2019, 4:58pm UTC](https://discuss.elastic.co/t/copy-to-create-array-of-string/168878/1 "2019-02-18T16:58:59Z")

</div>

I'm using the `copy_to` in two fields: `city_name` and`neighborhood_name` for the `full_data` field, so I need to use a `match_phrase_prefix`, but that does not work.

I've set `"store": true`, in `full_data` and I noticed that `full_data` has an array of tokens, how can I convert an array to a string?

Example:

city\_name = Campinas  
neighborhood\_name = Change

full\_data = ['Cambui', 'Campinas']

```
{
  "tokens": [
     {
          "token": "cambui",
          "start_offset": 0,
          "end_offset": 6,
          "type": "word",
          "position": 0
    }
   {
          "token": "campinas",
          "start_offset": 7,
          "end_offset": 15,
          "type": "word",
          "position": 101
    }
  ]
}

```

but what I need is

```
{
  "tokens": [
     {
       "token": "cambui campinas",
       "start_offset": 0,
        "end_offset": 15,
        "type": "shingle",
        "position": 0
      }
   ]
}

```

and my query:

```
  {
      "match_phrase_prefix": {
           "full_data.shingle": {
                "query": "cambui campinas"     
           }
        }
   }
```

---

<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:** [March 18, 2019, 5:09pm UTC](https://discuss.elastic.co/t/copy-to-create-array-of-string/168878/2 "2019-03-18T17:09:45Z")

</div>

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