顿搜
飞过闲红千叶,夕岸在哪
类目归类
PUT dbindex/_doc/1
{
"name":"clay",
"age":18,
"actiontime":"2021-05-02 23:22:22.333",
"id":123
}
- 如上语句创建了一个名为dbindex的索引库
- 插入数据的文档_id是1,
- 而{}中包含的是对应的字段名称和字段值。
POST /dbindex/_doc/
{
"filed1":"values1",
"filed2":"values2",
"filed3":"values3",
"filed4":"values4"
}通过POST进行文档插入时,用户不需要关注_id字段值(系统会自动生成唯一的_id字段值)
使用POST新增文档的时候不能指定文档_id(主键字段),只能由系统自动生成。当指定了_id字段之后,执行结果会返回异常信息
POST /userinfo/_doc/_bulk
{ "index": {}}
{"name":"张三","address":"中国","age":18}
{ "index": {}}
{"name":"李四","address":"中国","age":19}
{ "index": {}}
{"name":"王五","address":"美国","age":20}
{ "index": {}}
{"name":"赵六","address":"美国","age":21}