【问题标题】:how to use Postman to Insert Document in Elastic Search如何使用 Postman 在 Elastic Search 中插入文档
【发布时间】:2023-03-16 09:35:01
【问题描述】:

我需要什么

我在这里尝试

   PUT /customer/_doc/1?pretty
  {
   "name": "John Doe"
  }

需要错误请求正文

当我尝试运行 url 时的快照

1.http://localhost:9200/customer?pretty

2.http://localhost:9200/customer/_doc/1?pretty&pretty

3.http://localhost:9200/customer/_doc/1?pretty&pretty&name=test

任何人都可以建议如何在 Elastic 搜索中插入文档。

  • 欢迎提出任何建议。

【问题讨论】:

  • Body 请求选项卡中有什么?
  • 你能告诉我如何通过邮递员插入文件。
  • 您需要在请求正文中插入 JSON 文档,并确保使用 application/json 值指定 Content-Type 请求标头。

标签: elasticsearch


【解决方案1】:

在 body 中传递 Json 并更改 URL 如下所示:

【讨论】:

    【解决方案2】:

    同样使用 PUT 方法。

    网址是"http://localhost:9200/movies/"

    movies 是索引的名称。

    要发布的json是:

    {
    "id" : 1,
    "title" : "Toy Story 1",
    "year" : 1995,
    "category" : "Adventure"
    }
    

    这是邮递员将数据推送到elasticseach的截图:

    您可以通过以下方式验证数据:

    使用GET方法和url为http://localhost:9200/movies/_search?

    【讨论】:

      猜你喜欢
      • 2020-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-12
      • 1970-01-01
      • 1970-01-01
      • 2018-08-01
      相关资源
      最近更新 更多