gpt4 book ai didi

elasticsearch - 如何使用 Postman 将 JSON 数组添加到 elasticsearch

转载 作者:行者123 更新时间:2023-12-03 01:36:38 25 4
gpt4 key购买 nike

我尝试按以下方式使用 postman 添加示例数据集,

POST URL:  http://localhost:9200/allData

以 json 格式添加到 postman 正文
{
"index": "allData",
"type": "all",
"id": 1006,
"body": {

"id": 1006,
"url": "https://en.wikiversity.org/wiki/Principles_of_Management",
"title": "Principles of Management",
"author": "",
"rate": 0,
"ratedBy": 0,
"datePublished": "2018-01-01T00:00:00",
"publishedDate": "2018-01-01"
}
}

但它给出了以下错误。

No handler found for uri [/] and method [POST]



有人请帮我解决这个问题。谢谢

最佳答案

您的请求存在某些问题:

  • Elasticsearch 索引名称不能大写,因此在您的情况下它应该是 所有数据 不是 全部数据 .
  • URL 格式错误。

  • 您的网址应采用以下格式:
    http://localhost:9200/{indexname}/{type}/{id}

    在您的情况下必须是:
    http://localhost:9200/alldata/all/1006

    因此,您应该对上述 url 执行 POST 请求,正文如下:
    {
    "id": 1006,
    "url": "https://en.wikiversity.org/wiki/Principles_of_Management",
    "title": "Principles of Management",
    "author": "",
    "rate": 0,
    "ratedBy": 0,
    "datePublished": "2018-01-01T00:00:00",
    "publishedDate": "2018-01-01"
    }

    看看 Elasticsearch Reference Guide .

    希望能帮助到你 !

    关于elasticsearch - 如何使用 Postman 将 JSON 数组添加到 elasticsearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51951503/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com