示例:
PUT /spring-elasticsearch-demo/person/1 HTTP/1.1
Host: localhost:9200
Content-Type: application/json
cache-control: no-cache
Postman-Token: 1df2c7ea-a830-4778-b7a6-884dffa80f89
{
"id":"1",
"name":"天天向下",
"description":"这是天天向下",
"age":24,
"create":1535760000001
}
{
"_index": "spring-elasticsearch-demo",
"_type": "person",
"_id": "1",
"_version": 1,
"result": "created",
"_shards": {
"total": 2,
"successful": 2,
"failed": 0
},
"_seq_no": 0,
"_primary_term": 1
}
保存文档使用PUT方法,请求URL为/{索引名称}/{类型名称}/{id},如果文档不存在则插入,如果文档存在则更新,返回为:
属性 | 描述 |