ElasticSearch 新增

插入文档

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

posted @ 2021-03-11 09:11  RoinBi  阅读(91)  评论(0编辑  收藏  举报