'Use of wrong HTTP verb while creating elasticsearch index

To create an index in the elasticsearch, we need to use the PUT verb, for example, the following command:

curl -X PUT "localhost:9200/test_index" -d '{"settings":{"number_of_shards":2, "number_of_replicas":2}}' --header 'Content-Type: application/json'

But according to RFC 2616, § 9.5, POST can be also used to create a resource.

Why POST is not suitable here or why did elasticsearch designer use PUT instead of POST?



Solution 1:[1]

I found some posts related to your question. This answer from one of the ElasticSearch engineers might be helpful to you.

https://discuss.elastic.co/t/when-to-use-put-versus-post/68550/3

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 andrecoelho.rabbitbr