Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Trying to POST data to ElasticSearch server 8.6, but getting error "no handler found for uri"

I’m trying to send data to an ElasticSearch server using CURL. There is an index called ‘datastream2’ which has a lot of fields sorta like this:

"datastream2": {
"mappings": {
"properties": {
"UA": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 512
}
}
},
"accLang": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}…

I’d like to use CURL to send data to this index.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I’ve been using CURL for the attempted POST like this:

curl -v -X POST http://66-228-66-111.ip.linodeusercontent.com:9200/datastream2/newdocname -H "Content-type: application/json" –user elastic:u34XXXc2qYNGnVS4XXXA -d ‘{"UA":"Mozilla","acclang":"eng"}’

but it’s failing with the message:

{"error":"no handler found for uri [/datastream2/newdocname] and method [POST]"}%

I will admit that I’m not sure what to put after the indexname of ‘/datastream2/’ , but I’ve tried various different values. Some documentation says to list the type (which I’m not sure where to find) and some docs say that this is no longer necessary on ElasticSearch 8+ .

Any ideas how I can get this data posted into ElasticSearch?

>Solution :

You just need to replace newdocname by _doc and it will work

curl -v -X POST http://66-228-66-111.ip.linodeusercontent.com:9200/datastream2/_doc
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading