Reputation: 11
I am trying to add data to elasticsearch with both PUT and POST
curl -k -XPUT 'https://localhost:9200/blog/article/1' -d '{"title": "New version of Elasticsearch released!", "content": "Version 2.2 released today!", "priority": 10, "tags": ["announce", "elasticsearch", "release"] }'
but I am getting error:
{"error":"no handler found for uri [/blog/article/1] and method [PUT]"}
curl -k -XPOST 'https://localhost:9200/blog/article/' -d '{"title": "New version of Elasticsearch released!", "content": "Version 2.2 released today!", "priority": 10, "tags": ["announce", "elasticsearch", "release"] }'
{"error":"no handler found for uri [/blog/article/] and method [POST]"}
Upvotes: 0
Views: 2173
Reputation: 1
I also got the error No handler found for uri [/indexname/Â ] and method [DELETE]
, which was caused by left over undesired white space. If you are using Linux, check with VI whether there is any left-over white space by moving the cursor to the end of the call to curl
.
Upvotes: 0
Reputation: 10356
This is expected behaviour as those endpoint do not exist. You should refer to the official documentation for indexing documents.
Request to index a document should look like so:
PUT /<target>/_doc/<_id>
POST /<target>/_doc/
PUT /<target>/_create/<_id>
POST /<target>/_create/<_id>
In my example I choose the first flavour.
Noticed I have renamed the index to blog_article
curl -k -XPOST 'https://localhost:9200/blog_article/_doc/1' -H "Content-Type: application/json" -d '{"title": "New version of Elasticsearch released!", "content": "Version 2.2 released today!", "priority": 10, "tags": ["announce", "elasticsearch", "release"] }'
Upvotes: 2