# What is the difference between POST an PUT in the ElasticSearch API?

**URL:** <https://discuss.elastic.co/t/what-is-the-difference-between-post-an-put-in-the-elasticsearch-api/31995>\
**Category:** Elasticsearch\
**Created:** [October 12, 2015, 9:21am UTC](https://discuss.elastic.co/t/what-is-the-difference-between-post-an-put-in-the-elasticsearch-api/31995 "2015-10-12T09:21:15Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [January 19, 2017, 6:44am UTC](https://discuss.elastic.co/t/what-is-the-difference-between-post-an-put-in-the-elasticsearch-api/31995/10 "2017-01-19T06:44:24Z")

</div>

Read

> [@When to use PUT versus POST?](https://discuss.elastic.co/t/when-to-use-put-versus-post/68550/2):
>
> It's all about REST semantics. POST basically that you are posting a request which is going to modify the server state. POST index/type { "foo": "bar" } will generate an \_id server side and will index the document with this \_id. PUT is used to send a resource to the server. PUT index/type/id { "foo": "bar" } will put or update a document named index/type/id in the server. Makes sense? More details here: [https://en.wikipedia.org/wiki/Representational\_state\_transfer](https://en.wikipedia.org/wiki/Representational_state_transfer)

---

_[View the full topic](https://discuss.elastic.co/t/what-is-the-difference-between-post-an-put-in-the-elasticsearch-api/31995)._
