首页 > 其他 > 详细

ElasticSearch 新增

时间:2021-03-11 10:19:58      阅读:15      评论:0      收藏:0      [点我收藏+]

插入文档

1.1 PUT //_create/<_id>

PUT /movies/_create/100002
{
  "year" : 1995,
    "title" : "Dracula: Dead and Loving It1", 
    "id" : "12",
    "genre" : [
      "Comedy"
    ]
}

id如果存在,则报错;

1.2 POST //_create/<_id>

POST /movies/_create/100003
{
  "year" : 1995,
    "title" : "Dracula: Dead and Loving It1", 
    "id" : "12",
    "genre" : [
      "Comedy"
    ]
}

id如果存在,则报错;

1.3 PUT //_doc/<_id>

PUT /movies/_doc/111220
{
  "year" : 1995,
    "title" : "Dracula: Dead and Loving It1", 
    "id" : "12",
    "genre" : [
      "Comedy"
    ]
}

id存在,则修改_version+1

1.4 POST //_doc

POST /movies/_doc 
{
  "year" : 1995,
    "title" : "Dracula: Dead and Loving It1", 
    "id" : "12",
    "genre" : [
      "Comedy"
    ]
}

id不设置,id会随机生成。id设置且存在,则修改_version+1

ElasticSearch 新增

原文:https://www.cnblogs.com/roinbi/p/14515707.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!