diff --git a/docs/reference/mapping/params/copy-to.asciidoc b/docs/reference/mapping/params/copy-to.asciidoc index 1254113f5e37a..5bdf39c521301 100644 --- a/docs/reference/mapping/params/copy-to.asciidoc +++ b/docs/reference/mapping/params/copy-to.asciidoc @@ -69,30 +69,47 @@ The following configuration will not copy data from `field_1` to `field_3`: + [source,console] ---- +PUT /bad_example_index { - "field_1": { - "type": "text", - "copy_to": "field_2" - }, - "field_2": { - "type": "text", - "copy_to": "field_3" + "mappings": { + "properties": { + "field_1": { + "type": "text", + "copy_to": "field_2" + }, + "field_2": { + "type": "text", + "copy_to": "field_3" + }, + "field_3": { + "type": "text" + } + } } } ---- -// TEST[skip:] Instead, copy to multiple fields from the source field: + [source,console] ---- +PUT /good_example_index { - "field_1": { - "type": "text", - "copy_to": [ "field_2", "field_3" ] + "mappings": { + "properties": { + "field_1": { + "type": "text", + "copy_to": ["field_2", "field_3"] + }, + "field_2": { + "type": "text" + }, + "field_3": { + "type": "text" + } + } } } ---- -// TEST[skip:] NOTE: `copy_to` is not supported for field types where values take the form of objects, e.g. `date_range`.