当前位置:网站首页>Es document operation
Es document operation
2022-07-19 04:54:00 【Ozawa can't Java】
1. The new document ( Be sure to add documents id, Otherwise, documents will be generated randomly id)
grammar :
POST / Index library name /_doc/ file id
{
" Field 1": " value 1",
" Field 2": " value 2",
" Field 3": {
" Sub properties 1": " value 3",
" Sub properties 2": " value 4"
},
// ...
}
Example :
POST /xiaoze/_doc/1
{
"info": "xiaoze Study Java",
"email": "[email protected]",
"name": {
"firstName": " Hao ",
"lastName": " o "
}
}
2. Query the document
according to rest style , What's new is post, The query should be get, However, queries generally require conditions , Here we put the document id close .
grammar :
GET /{ Index library name }/_doc/{id}
adopt kibana View the data :
GET /xiaoze/_doc/1
3. Delete the document
Delete use DELETE request , Again , Need basis id To delete :
grammar :
DELETE /{ Index library name }/_doc/id value
Example :
# according to id Delete data
DELETE /xiaoze/_doc/1
4. Modify the document
There are two ways to modify :
Full revision : Directly overwrite the original document
Incremental changes : Modify some fields in the document
4.1. Full revision
Full modification is to overwrite the original document , Its essence is :
According to the designation id Delete the document
Add the same id Documents
Be careful : If according to id deleted ,id non-existent , The addition of the second step will also be executed , It changes from modifying to adding .
grammar :
PUT /{ Index library name }/_doc/ file id
{
" Field 1": " value 1",
" Field 2": " value 2",
// ... A little
}
4.2. Incremental changes
Incremental modification is to modify only the specified id Some fields in the matching document .
grammar :
POST /{ Index library name }/_update/ file id
{
"doc": {
" Field name ": " New value ",
}
}
Example :
POST /xiaoze/_update/1
{
"doc": {
"email": "[email protected]"
}
}
5. summary
What are the document operations ?
create documents :POST /{ Index library name }/_doc/ file id { json file }
Query the document :GET /{ Index library name }/_doc/ file id
Delete the document :DELETE /{ Index library name }/_doc/ file id
Modify the document :
Full revision :PUT /{ Index library name }/_doc/ file id { json file }
Incremental changes :POST /{ Index library name }/_update/ file id { "doc": { Field }}
边栏推荐
- 中台的订单系统
- Service end interface test - test point of interface test [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]
- 【FPGA教程案例27】通过Verilog实现双口RAM乒乓结构
- 高等数学笔记:关于等价无穷小替换的一个猜想
- Efficient insertion of references in word with thousands of words and many pictures
- DSL查询文档
- Base64与文件互转
- Common PostgreSQL data operation notes (updated from time to time)
- Multiple connections will be maintained for each provider instance
- MYSQL模糊匹配1,11,111这种相似字符串问题
猜你喜欢
随机推荐
数据库取配置文件字段,然后进行数据处理和判断
Database and the future of open source
[FPGA tutorial case 27] realize dual port RAM ping-pong structure through Verilog
And predicts that nerf will eventually replace deepfake
CKA 核心知识点概述
Pingcap clinic data acquisition instructions
浅聊全局过滤器
OLTP Load Performance Optimization Practice
Project structure of wechat applet
微服务高并发服务治理
ThinkPHP official website tutorial
类对象自动注入属性操作工具
Tidb performance optimization overview
记录一次存储过程批量修改表结构
【燃料电池】基于simulink的燃料电池系统控制策略仿真
Masm32 writer
超链接实现post方式提交
Exploration: pharmaceutical factory system network clock synchronization (NTP time synchronization server)
Common PostgreSQL data operation notes (updated from time to time)
junit4和junit5区别



[email protected]: `node install.js` 的问题"/>




