代码之家  ›  专栏  ›  技术社区  ›  nz_21

尝试将文档插入elasticsearch索引时出现“错误的HTTP方法”

  •  0
  • nz_21  · 技术社区  · 7 年前

    我有一堆json文档 my_docs.json http://localhost:9200/twitter 哪里 twitter

    我试过: curl -XPOST 'http://localhost:9200/twitter' -d @my_docs.json

    {"error":"Incorrect HTTP method for uri [/twitter] and method [POST], allowed: [DELETE, PUT, GET, HEAD]","status":405}
    

    我该如何解决这个问题?

    1 回复  |  直到 7 年前
        1
  •  0
  •   Matthew Pope    7 年前

    {
        "error":"Incorrect HTTP method for uri [/twitter] and method [POST], allowed: [DELETE, PUT, GET, HEAD]",
        "status":405
    }
    

    你应该使用 PUT POST