Adding copy_to to type: geo_point throws illegal_state_exception: "Can't get text on a END_ARRAY" exception

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
}
2 Likes

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