How to retrieve the copy_to fields in Elasticsearch?

Viewed 17

I have a mapping where I am copying some nested field to parent and enabling store: true and still I am not able to get the value of the fields.

"global_status": {
    "type": "text",
    "store": true
},
"global_sub_status": {
    "type": "text",
    "store": true
},
"initial": {
    "type": "object",
    "properties": {
        "status": {
            "type": "object",
            "properties": {
                "main_status": {
                    "type": "keyword",
                    "copy_to": "global_status"
                },
                "sub_status": {
                    "type": "keyword",
                    "copy_to": "global_sub_status"
                }       
            }                       
        }

    }
}

When I get the query in ES like this:

{
    "query": {
        "match_all": {}
    },
    "stored_fields": [ "global_status"]
}

I only get the hit for the document index and not getting the value of global_status.

"hits": {
    "total": 1,
    "max_score": 1.0,
    "hits": [
        {
            "_index": "deposits-records-faser-v0.0.12",
            "_type": "faser-v0.0.12",
            "_id": "520bd767-b9b9-4035-a4e4-2cb0f439de09",
            "_score": 1.0
        }
    ]
}

What I missing here?

0 Answers
Related