Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi evryone , i want to send data to my elasticsearch database. for that I recover my data from an oracle database I transform them into json and send them via a REST request on talend
I use elasticsearch versions 7.0.1 and talend 7.1.1
data send :
{"name": "Fabrice", "site": "Paris", "department": "North West"}
method Post in this url : "http://localhost:9200/myIndex"
i have this error :
exception in component tRESTClient_1 (DataOracleToJson)
javax.ws.rs.WebApplicationException: HTTP 400 Bad Request
Hi,
you put "Content-Type" and "Accept" into the wrong place
if you want to use them (it will work and without) - use Advanced settings headers section
add:
one more:
both parts of the full address:
URL - http://localhost:9200
Relative path - /myindex/_doc
thank you for your answer, I remove but still the same problem :
Exception in component tRESTClient_1 (DataOracleToJson) javax.ws.rs.WebApplicationException: HTTP 400 Bad Request at local_projectoracle_to_json.dataoracletojson_0_1.DataOracleToJson.tWriteJSONField_2_InProcess(DataOracleToJson.java:2621) at local_projectoracle_to_json.dataoracletojson_0_1.DataOracleToJson$1ThreadXMLField_tWriteJSONField_2_Out.run(DataOracleToJson.java:930)
yet if I run the query with curl it works
curl -XPOST "http://localhost:9200/myIndex/_doc" -H 'Content-Type: application/json' -d' {"name": "Fabrice", "site": "Paris", "department": "North West"}'
please see add part of answer
I mean - see "add" section in my answer 🙂
your address is duplicate each other, but it really - 2 parts of the same address
also - good to add some connection to response and error flows from tRESTClient
both parts of the full address: URL - http://localhost:9200 Relative path - /myindex/_doc
thanks for your answer, i edit but there is always the same error HTTP 400 Bad Request, I look with wireshark, the request is send but the json object is not send
Hi,
there need to check all chain - what and how you prepare, types, column name
in my case, I use a single tXMLMap instead of tMap + tWriteJSON and populate column body (type document)
everything work
I put the tXMLMap and I checked all the chain I see the object json go until tRestClient, everything seems ok. I think the problem comes from the configuration of the tRestClient, how to fill the body of the column (document type)
with curl :
With curl
with talend:
With talend