ElasticSearh更新nested字段(Array数组)。怎么根据查询条件(query)复制一个(index)到新的Index how to update by query a nested fields data for elasticsearch
GET usernested/_search
{
"query": {
"nested": {
"path": "tags",
"query": {
"bool": {
"must": [
{
"term": {
"tags.brandid": "93a8296c-5b64-49ea-bd92-b19192def2e9"
}
},
{
"term": {
"tags.site": "163"
}
}
]
}
}
}
}
} //按照条件新建一个index 作为测试数据使用
POST _reindex
{
"source": {
"index": "usernested",
"query": {
"nested": {
"path": "tags",
"query": {
"bool": {
"must": [
{
"term": {
"tags.brand": "c55fd643-1333-4647-b898-fb3e5e4e6d67"
}
},
{
"term": {
"tags.site": "163"
}
}
]
}
}
}
}
},
"dest": {
"index": "new_usernested"
}
} //查询
GET new_usernested/_search
{
"query": {
"nested": {
"path": "tags",
"query": {
"bool": {
"must": [
{
"term": {
"tags.brand": "c55fd643-1333-4647-b898-fb3e5e4e6d67"
}
},
{
"term": {
"tags.site": "163"
}
}
]
}
}
}
}
} //根据条件更新一个 nested的文档
GET usernested/_update_by_query
{
"query": {
"nested": {
"path": "tags",
"query": {
"bool": {
"must": [
{
"term": {
"tags.brand": "c55fd643-1333-4647-b898-fb3e5e4e6d67"
}
},
{
"term": {
"tags.site": "163"
}
}
]
}
}
}
},
"script": {
"inline": "for(e in ctx._source.tags){e.brand = 'test2';}" //更新nested字段
//"inline":"ctx._source.userid = 'testid'" //更新普通字段
}
}
ElasticSearh更新nested字段(Array数组)。怎么根据查询条件(query)复制一个(index)到新的Index how to update by query a nested fields data for elasticsearch的更多相关文章
- find、findIndex、indexOf、lastIndex、includes 数组五种查询条件方法介绍
find() 方法返回数组中满足提供的测试函数的第一个元素的值. 语法: arr.find(callback[, thisArg]) findIndex()方法返回数组中满足提供的测试函数的第一个元素 ...
- thinkphp 多个字段的不同关系的查询条件实现 .
tp的$map不同条件默认是 and ,如果要用or<><><><>如下 例如查询Stu表中年龄大于18,或者身高低于180cm的男性(1为男性),(例 ...
- PostgreSQL Array 数组类型与 FreeSql 打出一套【组合拳】
前言 PostgreSQL 是世界公认的功能最强大的开源数据库,除了基础数据类型 int4/int8/varchar/numeric/timestamp 等数据类型,还支持 int4[]/int8[] ...
- JavaScript的json和Array及Array数组的使用方法
1.关于json JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.它基于ECMAScript的一个子集.也可以称为数据集和数组类似,能够存数据! //Ar ...
- JS中Array数组的三大属性用法
原文:JS中Array数组的三大属性用法 Array数组主要有3大属性,它们分别是length属性.prototype属性和constructor属性. JS操作Array数组的方法及属性 本文总结了 ...
- MongoDB的批量查询条件进行批量更新数据
今天遇到这样一个场景:在Java中批量更新MongoDB数据,不过每次更新的条件有不一样,那如何有效地进行更新操作呢? 刚开始的时候,我是想到循环批量更新操作,即每一种查询条件进行一次批量更新过程,这 ...
- for 循环 和 Array 数组对象
博客地址:https://ainyi.com/12 for 循环 和 Array 数组对象方法 for for-in for-of forEach效率比较 - 四种循环,遍历长度为 1000000 的 ...
- Javascript中的Array(数组) 、{}(映射) 与JSON解析
做网页总会使用javascript,使用javascript总会使用JSON.最近用到一下,就写写. 下面是总结: 1.将javascript中的Array和{}转化为json字符串可以使用json2 ...
- List集合与Array数组之间的互相转换
1.数组转换成List集合 采用java中集合自带的asList()方法就可以完成转换了 String[] array = new String[] {"zhu", "w ...
随机推荐
- hadoop三个配置文件的参数含义说明(转)
来自:http://blog.csdn.net/yangjl38/article/details/7583374 1 获取默认配置 配置hadoop,主要是配置core-site.xml, ...
- SpringMVC+Spring+mybatis项目从零开始--分布式项目结构搭建
转载出处: SpringMVC+Spring+mybatis+Redis项目从零开始--分布式项目结构搭建 /** 本文为博主原创文章,如转载请附链接. **/ SSM框架web项目从零开始--分布式 ...
- Python实现支付宝当面付之——扫码支付
转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/7680348.html 一:配置信息准备 登录蚂蚁金服开放平台:https://open.alipay.com/ ...
- MobX快速入门教程(重要概念讲解)
转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/7372119.html 一:Mobx工作流程图 二:MobX涉及到的概念 1:状态state 组件中的数据. 2 ...
- CentOS 7 安装php5.6,Nginx,Memcached环境及配置
安装php5.6版本以后不再需要安装Zend Guard,而是用yum命令安装php-opcache及php-pecl-apcu就可以有效的提高php执行速度. 1. 配置yum源 事先确认yum源的 ...
- 用OpenSSL把二进制的Cer证书转换程Base64格式的PEM格式的证书
openssl x509 -inform der -in /d/ty.cer -pubkey -noout > /d/certificate_publickey.pem
- cpu高 load 高 内存高 io 高怎么排查
一个应用占用CPU很高,除了确实是计算密集型应用之外,通常原因都是出现了死循环. (友情提示:本博文章欢迎转载,但请注明出处:hankchen,http://www.blogjava.net/hank ...
- 使用gprof2dot和graphivz生成程序运行调用图
使用gprof2dot和graphivz生成程序运行调用图 gprof2dot是一个将gprof生成的输出转换为dot脚本的工具.通过给定一个gprof的输出文件,将其转换为生成程序调用图的dot脚本 ...
- 在Java中使用Kafka
Producer部分 Producer在实例化后, 对外提供send方法, 用于将数据送到指定的topic和partition; 以及在退出时需要的destroy方法. 接口 KafkaProduce ...
- 多线程场景下如何使用 ArrayList
ArrayList 不是线程安全的,这点很多人都知道,但是线程不安全的原因及表现,怎么在多线程情况下使用ArrayList,可能不是很清楚,这里总结一下. 1. 源码分析 查看 ArrayList 的 ...