【问题标题】:send json data via REST request on talend在 talend 上通过 REST 请求发送 json 数据
【发布时间】:2019-10-03 18:30:55
【问题描述】:

我想将数据发送到我的 elasticsearch 数据库。 为此,我从 oracle 数据库中恢复我的数据,我将它们转换为 json 并通过 talend 上的 REST 请求发送它们

我使用 elasticsearch 版本 7.0.1 和 talend 7.1.1

数据发送:

{"name": "Fabrice", "site": "Paris", "department": "North West"}

方法放在这个网址:“http://localhost:9200/my_index

我有这个错误:

组件 tRESTClient_1 (myProject) 中的异常
javax.ws.rs.WebApplicationException: HTTP 405 方法不允许

【问题讨论】:

    标签: json rest elasticsearch talend


    【解决方案1】:

    如果你没有在url中传递一个ID,那么你需要使用“POST”方法。

    我在尝试运行您在 Kibana 中发布的查询时遇到了类似的错误。

    您可以在此处阅读更多内容: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html

    PS:我不知道 Talend 是如何发挥作用的,但我假设您是在本地运行它,否则我会预料到无法访问“localhost”的不同错误。

    【讨论】:

    • 感谢您的回答,我确实发布了,现在我在组件 tRESTClient_1 (myproject) javax.ws.rs.WebApplicationException 中出现另一个不同的错误异常:HTTP 400 Bad Request
    • 你有“_doc”吗?包括?这是一个适合我的完整卷曲。 :curl -XPOST "http://localhost:9200/my_index/_doc" -H 'Content-Type: application/json' -d' {"name": "Fabrice", "site": "Paris", "department": "North West"}'
    • curl 的请求运行良好,{"_index":"my_index","_type":"_doc","_id":"cxKpxGoBohmIlODzkrLA","_version":1,"result": "created","_shards":{"total":2,"successful":1,"failed":0},"_seq_no":0,"_primary_term":5}
    猜你喜欢
    • 2016-07-19
    • 1970-01-01
    • 2016-01-25
    • 2017-01-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-08
    • 1970-01-01
    相关资源
    最近更新 更多