Is it possible to get contents of copy_to field in Elasticsearch? Is it possible to get contents of copy_to field in Elasticsearch? elasticsearch elasticsearch

Is it possible to get contents of copy_to field in Elasticsearch?


In the mapping for text field set "store":"yes"The you should be able to fetch it using fields

Example:

put test/test/_mapping{  "properties" : {   "name" : { "type" : "string","copy_to": "text"},   "text" : {"type" : "string" ,"store" :"yes"},    "subfield": {        "properties": {          "subsubfield": {            "properties": {              "subtext": {                "index": "no",                "type": "string",                "copy_to": "text"              }            }            }        }      }  }       }put test/test/1 {    "name" : "hello",    "subfield" : {        "subsubfield" : [            {"subtext" : "soundgarden" },            {"subtext" : "alice in chains" },            {"subtext" : "dio" }        ]    }} post test/_search{    "stored_fields": [       "text"    ]}

Results

{   "took": 2,   "timed_out": false,   "_shards": {      "total": 5,      "successful": 5,      "failed": 0   },   "hits": {      "total": 1,      "max_score": 1,      "hits": [         {            "_index": "test",            "_type": "test",            "_id": "1",            "_score": 1,            "fields": {               "text": [                  "hello",                  "soundgarden",                  "alice in chains",                  "dio"               ]            }         }      ]   }}