1

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?

Deepak Tatyaji Ahire
  • 4,883
  • 2
  • 13
  • 35

1 Answers1

0

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

rabbitbr
  • 2,991
  • 2
  • 4
  • 17