XPOST Failing

Hi,

I am running elasticsearch 8.2.3 from my laptop.

Able to check health, create index but insert document is failing.
Could you please help what's the problem here.

C:\Users\ravich>curl --insecure -H "Content-Type: application/json" -XPUT "https://elastic:PASSWORD@172.20.192.1:9201/customer/external/1" -d "{ "name" : "chandra"}"
{"error":"no handler found for uri [/customer/external/1] and method [PUT]"}

Thanks,
Chandra

Hello @chandramouli_ravi

By seeing the command , i could confirm that you are curling in windows.Try this command it will work for sure

curl -XPUT "http://elastic:PASSWORD@localhost:9200/customer/_doc/1?pretty" -H "Content-Type: application/json" -d"{\"name\":\"Chandra\"}"

Keep posted !!! Thanks !!!

PS: I would also request you to change the case title XPUT Failing as you are curling with PUT

1 Like

Hi @sudhagar_ramesh

Your base syntax is incorrect assuming you want to put this in the index name customer

I'm not sure where you got the external part of the curl where you have that should be _doc which is the type... Always the type other types were eliminated in 7.x

To PUT which means you can set the document ID.

curl --insecure -H "Content-Type: application/json" -XPUT "https://elastic:PASSWORD@172.20.192.1:9201/customer/_doc/1" -d "{ "name" : "chandra"}"

POST where it would create its own generated document ID.

curl --insecure -H "Content-Type: application/json" -XPOST "https://elastic:PASSWORD@172.20.192.1:9201/customer/_doc" -d "{ "name" : "chandra"}"

2 Likes

Hello @stephenb

Thanks for your inputs.
Thought the externals is used as doc type by user.

i have changed it now.

1 Like

Thank you @stephenb @sudhagar_ramesh
I am able to run now

For everyone's use, working command which is same as suggested.

curl --insecure -H "Content-Type: application/json" -XPUT "https://elastic:password@172.20.192.1:9201/customer/_doc/1" -d "{"name" : "chandra"}"

2 Likes

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.