(十一)Updating Documents
In addition to being able to index and replace documents, we can also update documents. Note though that Elasticsearch does not actually do in-place updates under the hood. Whenever we do an update, Elasticsearch deletes the old document and then indexes a new document with the update applied to it in one shot.
curl -X POST "localhost:9200/customer/_doc/1/_update?pretty" -H 'Content-Type: application/json' -d'
{
"doc": { "name": "Jane Doe" }
}
'
This example shows how to update our previous document (ID of 1) by changing the name field to "Jane Doe" and at the same time add an age field to it:
curl -X POST "localhost:9200/customer/_doc/1/_update?pretty" -H 'Content-Type: application/json' -d'
{
"doc": { "name": "Jane Doe", "age": }
}
'
Updates can also be performed by using simple scripts. This example uses a script to increment the age by 5:
curl -X POST "localhost:9200/customer/_doc/1/_update?pretty" -H 'Content-Type: application/json' -d'
{
"script" : "ctx._source.doc.age += 5"
}
'
In the above example, ctx._source
refers to the current source document that is about to be updated.
SQL UPDATE-WHERE
statement). See docs-update-by-query
API(十一)Updating Documents的更多相关文章
- MongoDB - MongoDB CRUD Operations, Update Documents
Update Methods MongoDB provides the following methods for updating documents in a collection: Method ...
- AsciiDoc
AsciiDoc Text based document generation AsciiDoc Home Page Table of Contents Introduction Overview a ...
- 翻译【ElasticSearch Server】第一章:开始使用ElasticSearch集群(7)
检索文档(Retrieving documents) 我们已经有文档存储在我们的实例.现在,让我们尝试检索它们: curl -XGET http://localhost:9200/blog/artic ...
- Java MongoDB Driver 3.x - Quick Start
Maven Dependency: <dependency> <groupId>org.mongodb</groupId> <artifactId>mo ...
- lucene原理及源码解析--核心类
马云说:大家还没搞清PC时代的时候,移动互联网来了,还没搞清移动互联网的时候,大数据时代来了. 然而,我看到的是:在PC时代搞PC的,移动互联网时代搞移动互联网的,大数据时代搞大数据的,都是同一伙儿人 ...
- elasticsearch6.7 01.入门指南(3)
4.Modifying Your Data(修改数据) Elasticsearch 提供了近实时的操纵数据和搜索的能力.默认情况下,从索引/更新/删除数据到在搜索结果中显示数据会有 1 秒的延迟(刷新 ...
- Elasticsearch-->Get Started-->Modifying Your Data
https://www.elastic.co/guide/en/elasticsearch/reference/current/getting-started-modify-data.html Mod ...
- lucene源码分析(2)读取过程实例
1.官方提供的代码demo Analyzer analyzer = new StandardAnalyzer(); // Store the index in memory: Directory di ...
- windows系统中 利用kibana创建elasticsearch索引等操作
elasticsearch之借用kibana平台创建索引 1.安装好kibana平台 确保kibana以及elasticsearch正常运行 2.打开kibana平台在Dev Tools 3.创建一个 ...
随机推荐
- Chapter 5 Blood Type——22
Suddenly the sidewalk disappeared from beneath me. My eyes flew open in shock. 突然我身下的人行道消失了.我飞快的睁开眼睛 ...
- leetcode — remove-duplicates-from-sorted-list-ii
/** * Source : https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list-ii/ * * * Given a ...
- angr进阶(5)内存操作
angr也可以将符号写在内存里,控制内存中的值,结合任意位置开始有奇效,但就是慢sym-write p = angr.Project('./issue', load_options={"au ...
- [ SSH框架 ] Spring框架学习之三(AOP开发和注解的使用)
一.Spring 使用 AspectJ 进行 AOP 的开发:注解的方式 1.1 引入相关的jar包 1.2 引入spring的配置文件 <?xml version="1.0" ...
- 痞子衡嵌入式:ARM Cortex-M文件那些事(5)- 映射文件(.map)
大家好,我是痞子衡,是正经搞技术的痞子.今天痞子衡给大家讲的是嵌入式开发里的map文件. 第四节课里,痞子衡给大家介绍了第一种output文件-relocatable文件,本文继续给大家讲projec ...
- ZooKeeper的三种典型应用场景
引言 ZooKeeper是中典型的pub/sub模式的分布式数据管理与协调框架,开发人员可以使用它进行分布式数据的发布与订阅.另外,其丰富的数据节点类型可以交叉使用,配合Watcher事件通知机制,可 ...
- .net core EFCore CodeFirst 迁移出现错误【No project was found. Change the current working directory or use the --project option. 】
PM> dotnet ef Migrations add Init No project was found. Change the current working directory or u ...
- Go中局部全局变量的区分
这是可能也许是容易混淆滴,先上1个例子: package main import "fmt" var nickname = "大虾" func main() { ...
- 【Java】数组转List常见方式的对比
一.最常用通过 Arrays.asList(strArray) 方式,将数组转换List后,不能对List增删,只能查改,否则抛异常. 关键代码: List list = Arrays.asList( ...
- git 常用命令,上传,下载,更新线上代码
git 常用命令以及推荐git新建上传个人博客 $ git clone //本地如果无远程代码,先做这步,不然就忽略 $ git status //查看本地自己修改了多少文件 $ git add . ...