I'm using Elasticsearch v2.3.0. Suppose I have an index with mapping:
{
"mappings": {
"post": {
"dynamic": false,
"_source": {
"enabled": true
},
"properties": {
"text": {
"norms": {
"enabled": false
},
"fielddata": {
"format": "disabled"
},
"analyzer": "text_analyzer",
"type": "string"
},
"subfield": {
"properties": {
"subsubfield": {
"properties": {
"subtext": {
"index": "no",
"analyzer": "text_analyzer",
"type": "string",
"copy_to": "text"
}
}
}
}
}
},
"_all": {
"enabled": false
}
}
}
So, text from subfield.subsubfield.subtext
is copied to text field
due to copy_to
. If you query a post, then only data from text
is shown in text
field, because _source
is not modified. If you want to obtain all text, you should aggregate all fields on client. This can be inconvenient if there are many subfields.
Is there a magic query, which allows to get text
field with all text copied to it?
"store" : true
– Cicelycicenia