# Adding copy\_to to type: geo\_point throws illegal\_state\_exception: "Can't get text on a END\_ARRAY" exception

**URL:** https://discuss.elastic.co/t/adding-copy-to-to-type-geo-point-throws-illegal-state-exception-cant-get-text-on-a-end-array-exception/224072
**Category:** Elasticsearch
**Created:** [March 18, 2020, 10:40am UTC](https://discuss.elastic.co/t/adding-copy-to-to-type-geo-point-throws-illegal-state-exception-cant-get-text-on-a-end-array-exception/224072 "2020-03-18T10:40:42Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![shevah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shevah/32/52188_2.png) [@shevah](https://discuss.elastic.co/u/shevah)
#### Post date: [March 18, 2020, 10:40am UTC](https://discuss.elastic.co/t/adding-copy-to-to-type-geo-point-throws-illegal-state-exception-cant-get-text-on-a-end-array-exception/224072/1 "2020-03-18T10:40:42Z")

</div>

Hi.  
I would like to replicate the behavior of \_all field of ES5. I am using copy\_to for that.  
But, adding copy\_to to a field of type: geo\_point throws illegal\_state\_exception: "Can't get text on a END\_ARRAY" exception.

To reproduce create new index in ES 6.8.3:

```
PUT http://localhost:9200/my_index
{
"mappings": {
    "_doc": {
        "properties": {
            "location": {
                "type": "geo_point",
                "copy_to": [
                    "my_copy_to"
                ]
            },
            "my_copy_to": {
                "type": "text"
            }
        }
    }
}
}

```

Send

```
POST http://localhost:9200/my_index/_doc
{"location":[1,1]}

```

getting the following error:

```
    {
    "error": {
        "root_cause": [
            {
                "type": "mapper_parsing_exception",
                "reason": "failed to parse field [my_copy_to] of type [text] in document with id 'w3kt7XAB95lRrulO9_ik'"
            }
        ],
        "type": "mapper_parsing_exception",
        "reason": "failed to parse field [my_copy_to] of type [text] in document with id 'w3kt7XAB95lRrulO9_ik'",
        "caused_by": {
            "type": "illegal_state_exception",
            "reason": "Can't get text on a END_ARRAY at 1:17"
        }
    },
    "status": 400
}
```

---

<div class="post-metadata">

### Author: ![shevah](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shevah/32/52188_2.png) [@shevah](https://discuss.elastic.co/u/shevah)
#### Post date: [March 23, 2020, 8:40am UTC](https://discuss.elastic.co/t/adding-copy-to-to-type-geo-point-throws-illegal-state-exception-cant-get-text-on-a-end-array-exception/224072/2 "2020-03-23T08:40:12Z")

</div>

So we have try to reproduce this in ES5, and turns out that type:geo\_point in not stored in \_all field in ES5, so in that way the the behaviour is consistent

---

<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: [April 20, 2020, 8:40am UTC](https://discuss.elastic.co/t/adding-copy-to-to-type-geo-point-throws-illegal-state-exception-cant-get-text-on-a-end-array-exception/224072/3 "2020-04-20T08:40:23Z")

</div>

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