Search code examples
httpelasticsearchpostgetpostman

Elasticsearch Incorrect http method for uri for POST


I'm attempting to POST a document to an elasticsearch cluster I have cloud hosted via elastic cloud. I have an application currently running from TheThingsNetwork that is POSTing data just fine, however when I attempt to use postman or python requests module, I receive a 405 error when POSTing. GET requests work just fine and return a status of 200.

Here's my failed POST via postman:

Failed POST 405

Here's my successful GET via postman:

Successful GET - 200

This should be something very straightforward, so I imagine I'm missing simple. Any and all help is greatly appreciated!


Solution

  • This is because you're trying to POST to an index. Add a document type to the end of your url ex. /my_index/my_doc and you should be able to POST your document as my_doc document type.