当前位置:网站首页>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 }}
边栏推荐
- 面临的挑战和优势,并预测NeRF最终将取代Deepfake
- 有望取代Deepfake?揭秘今年超火的NeRF技
- OLTP Load Performance Optimization Practice
- 负载均衡添加ssl证书
- 服务端接口测试-接口测试的测试点【杭州多测师】【杭州多测师_王sir】
- Service end interface test - test point of interface test [Hangzhou multi tester] [Hangzhou multi tester _ Wang Sir]
- 新生任务-5
- Demo analysis of sliding conflict external interception method
- 一文了解定时任务
- Web development with fastapi
猜你喜欢

shardingsphere内核原理

thinkphp 官网教程

es的一些概念

EMQX 压力测试踩得坑供大家参考

TiDB 性能分析和优化

力扣刷题02(三数之和+最大子序和+二叉树最近公共祖先)

shardingproxy分库分表实战及同类产品对比

Reproduction of XOR and encryption decryption
![Money making master applet [latest version 5.9.9] mall / instant withdrawal of commission / distribution promotion / phone recharge / is meituan hungry for takeout](/img/8b/29027c2dee4ef764bb2e4b5b499a23.jpg)
Money making master applet [latest version 5.9.9] mall / instant withdrawal of commission / distribution promotion / phone recharge / is meituan hungry for takeout

UE-插件 ElectronicNodes 5.0.0/4.23-4.27
随机推荐
swagger的坑
Emqx pressure test tread pit for your reference
Monitoring and alarm of kubernetes
拥抱声明式UI
RestAPI
超链接实现post方式提交
负载均衡器ribbon实战
快速掌握MIPI开发攻略
三种高并发方式实现i++
Money making master applet [latest version 5.9.9] mall / instant withdrawal of commission / distribution promotion / phone recharge / is meituan hungry for takeout
Fudan micro fmql (domestic zynq) [PS of IAR bare metal development] - non byte aligned access
高等数学笔记:伍月习题选集
Warriors of the Visual Studio, Assemble! (warriors of visual studio, assemble!) Original 19:40:00 on July 12, 2009 label: compilation /mic
Overview of CKS core knowledge points
[Lipschitz] simulation of Lipschitz Lipschitz exponent based on MATLAB
【Lipschitz】基于matlab的Lipschitz李氏指数仿真
中台的订单系统
Notes on Advanced Mathematics: selected exercises of Wu Yue
高等数学笔记:复合函数的二阶导数与参数方程求解曲率
浅聊链路追踪