# How to write put mapping api using php code

**URL:** <https://discuss.elastic.co/t/how-to-write-put-mapping-api-using-php-code/205666>\
**Category:** Elasticsearch\
**Created:** [October 29, 2019, 12:40pm UTC](https://discuss.elastic.co/t/how-to-write-put-mapping-api-using-php-code/205666 "2019-10-29T12:40:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arunkvinam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/arunkvinam/32/43899_2.png) [@arunkvinam](https://discuss.elastic.co/u/arunkvinam)\
**Post date:** [October 29, 2019, 12:40pm UTC](https://discuss.elastic.co/t/how-to-write-put-mapping-api-using-php-code/205666/1 "2019-10-29T12:40:57Z")

</div>

how to write put mapping api using php code. currently iam using curl command

curl -X PUT "localhost:9200/new-index/\_mapping" -H 'Content-Type: application/json' -d' {"properties": { "new-email": {"type": "keyword"}}}'

please help me to convert this curl command to php code

---

<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:** [November 26, 2019, 12:51pm UTC](https://discuss.elastic.co/t/how-to-write-put-mapping-api-using-php-code/205666/2 "2019-11-26T12:51:37Z")

</div>

Closed on November 26, 2019, 12:51pm UTC

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