# How to restrict field to add data in copy\_to method

**URL:** <https://discuss.elastic.co/t/how-to-restrict-field-to-add-data-in-copy-to-method/195706>\
**Category:** Elasticsearch\
**Created:** [August 19, 2019, 9:24am UTC](https://discuss.elastic.co/t/how-to-restrict-field-to-add-data-in-copy-to-method/195706 "2019-08-19T09:24:11Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Debashis\_Mondal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/debashis_mondal/32/52537_2.png) [@Debashis\_Mondal](https://discuss.elastic.co/u/Debashis_Mondal)\
**Post date:** [August 19, 2019, 9:24am UTC](https://discuss.elastic.co/t/how-to-restrict-field-to-add-data-in-copy-to-method/195706/1 "2019-08-19T09:24:11Z")

</div>

Hi,  
I am using copy\_to method where I am trying to allow first\_name and last\_name to add data and full\_name will be read-only. The data will be added into the full\_name field automatically.

PUT my\_index  
{  
"mappings": {  
"properties": {  
"first\_name": {  
"type": "text",  
"copy\_to": "full\_name"  
},  
"last\_name": {  
"type": "text",  
"copy\_to": "full\_name"  
},  
"full\_name": {  
"type": "text"  
}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 19, 2019, 9:38am UTC](https://discuss.elastic.co/t/how-to-restrict-field-to-add-data-in-copy-to-method/195706/2 "2019-08-19T09:38:27Z")

</div>

can you please explain what the problem or the question here is? Please format your snippets, as you can use markdown in here and provide a **full** reproducible example (including data being indexed and queries executed) in order to other to reproduce.

Thanks!

---

<div class="post-metadata">

**Author:** ![Debashis\_Mondal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/debashis_mondal/32/52537_2.png) [@Debashis\_Mondal](https://discuss.elastic.co/u/Debashis_Mondal)\
**Post date:** [September 11, 2019, 7:28am UTC](https://discuss.elastic.co/t/how-to-restrict-field-to-add-data-in-copy-to-method/195706/3 "2019-09-11T07:28:50Z")

</div>

Hi,

Thanks for your reply

Here I am trying to concatenate the data from multiple field to a single field.  
like I have two field

first\_name  
last\_name

need to store all data from "first\_name" and "last\_name" into field "full\_name"  
but i don't want to allow user to add data into field "full\_name"  
I like to make "full\_name" as read only and only copied data from "first\_name" and "last\_name" field

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 9, 2019, 7:29am UTC](https://discuss.elastic.co/t/how-to-restrict-field-to-add-data-in-copy-to-method/195706/4 "2019-10-09T07:29:01Z")

</div>

Closed on October 9, 2019, 7:29am UTC

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
