elasticsearch 如何使用Postman将JSON数组添加到elasticsearch,elasticsearch,postman,elasticsearch,Postman" /> elasticsearch 如何使用Postman将JSON数组添加到elasticsearch,elasticsearch,postman,elasticsearch,Postman" />

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

elasticsearch 如何使用Postman将JSON数组添加到elasticsearch,elasticsearch,postman,elasticsearch,Postman,我尝试使用postman添加示例数据集,如下所示: POST URL: http://localhost:9200/allData 作为json添加到邮递员正文 { "index": "allData", "type": "all", "id": 1006, "body": { "id": 1006, "url": "https://en.wikiversity.org/wik

我尝试使用postman添加示例数据集,如下所示:

POST URL:  http://localhost:9200/allData
作为json添加到邮递员正文

{
    "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"   
    }
}
但它给出了以下错误

找不到uri[/]和方法[POST]的处理程序


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

您的请求存在某些问题:

  • Elasticsearch索引名称不能使用大写,因此在您的案例中,它应该是alldata而不是alldata
  • URL的格式错误
您的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"   
}
看一看这张照片

希望有帮助