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的更多相关文章

  1. find、findIndex、indexOf、lastIndex、includes 数组五种查询条件方法介绍

    find() 方法返回数组中满足提供的测试函数的第一个元素的值. 语法: arr.find(callback[, thisArg]) findIndex()方法返回数组中满足提供的测试函数的第一个元素 ...

  2. thinkphp 多个字段的不同关系的查询条件实现 .

    tp的$map不同条件默认是 and ,如果要用or<><><><>如下 例如查询Stu表中年龄大于18,或者身高低于180cm的男性(1为男性),(例 ...

  3. PostgreSQL Array 数组类型与 FreeSql 打出一套【组合拳】

    前言 PostgreSQL 是世界公认的功能最强大的开源数据库,除了基础数据类型 int4/int8/varchar/numeric/timestamp 等数据类型,还支持 int4[]/int8[] ...

  4. JavaScript的json和Array及Array数组的使用方法

    1.关于json JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式.它基于ECMAScript的一个子集.也可以称为数据集和数组类似,能够存数据! //Ar ...

  5. JS中Array数组的三大属性用法

    原文:JS中Array数组的三大属性用法 Array数组主要有3大属性,它们分别是length属性.prototype属性和constructor属性. JS操作Array数组的方法及属性 本文总结了 ...

  6. MongoDB的批量查询条件进行批量更新数据

    今天遇到这样一个场景:在Java中批量更新MongoDB数据,不过每次更新的条件有不一样,那如何有效地进行更新操作呢? 刚开始的时候,我是想到循环批量更新操作,即每一种查询条件进行一次批量更新过程,这 ...

  7. for 循环 和 Array 数组对象

    博客地址:https://ainyi.com/12 for 循环 和 Array 数组对象方法 for for-in for-of forEach效率比较 - 四种循环,遍历长度为 1000000 的 ...

  8. Javascript中的Array(数组) 、{}(映射) 与JSON解析

    做网页总会使用javascript,使用javascript总会使用JSON.最近用到一下,就写写. 下面是总结: 1.将javascript中的Array和{}转化为json字符串可以使用json2 ...

  9. List集合与Array数组之间的互相转换

    1.数组转换成List集合 采用java中集合自带的asList()方法就可以完成转换了 String[] array = new String[] {"zhu", "w ...

随机推荐

  1. mint 设置无线 AP

    所需软件: sudo apt-get install hostapd 1. 创建 hostapd 的 configure 文件 新建 hostapd.conf 文件,存放位置任意,与后面修改的路径一致 ...

  2. Mysql Left Join Where On

    select t1.id,t2.idfrom t1left join t2 on t1.id = t2.id and t1.id>1 and t2.id<>3在mysql的left ...

  3. J2EE开发之三种项目架构

    转载请注明原文地址:http://www.cnblogs.com/ygj0930/p/6285069.html 在我们开发项目时,一般都要先划分好哪些是与用户交互的,哪些用来处理请求/数据等等,这些过 ...

  4. Linux修改系统主机名

    Linux修改系统主机名 一.查看主机名   [root@xqzt ~]# uname -n xqzt [root@xqzt ~]# hostname xqzt 二.修改hostname的四种方式? ...

  5. Oracle列自增实现(2)-Identity Columns in Oracle Database 12c Release 1 (12.1)

    Oracle列自增-Identity Columns in Oracle Database 12c Release 1 (12.1) 在ORACLE 12C以前的版本中,如果要实现列自增长,需要通过序 ...

  6. C++11中的mutex, lock,condition variable实现分析

    本文分析的是llvm libc++的实现:http://libcxx.llvm.org/ C++11中的各种mutex, lock对象,实际上都是对posix的mutex,condition的封装.不 ...

  7. 基于py3和pymysql查询某时间段的数据

    #python3 #xiaodeng #基于py3和pymysql查询某时间段的数据 import pymysql conn=pymysql.connect(user='root',passwd='r ...

  8. curl定时任务下载执行

    服务器入侵后有定时任务执行如下,通过cron,下载脚本并执行!达到杀不死的木马进程 */5 * * * * curl -fsSL http://xxxx/pm.sh?0111 | sh curl参数解 ...

  9. Electromagnetic radiation and Radio 电磁波/电磁辐射和无线电波

    电磁辐射,又称电磁波,是由同相振荡且互相垂直的电场与磁场在空间中以波的形式传递能量和动量,其传播方向垂直于电场与磁场构成的平面. 电磁辐射的载体为光子,不需要依靠介质传播,在真空中的传播速度为光速.电 ...

  10. ios中PagedFlowView的用法

    下载地址 引入PagedFlowView.h  PagedFlowView.m文件 #import <UIKit/UIKit.h> #import "PagedFlowView. ...