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. Python有关模块学习记录

    1 pandas numpy模块 首先安装搭建好jupyter notebook,运行成功后的截图如下: 安装使用步骤(PS:确定Python安装路径和安装路径里面Scripts文件夹路径已经配置到环 ...

  2. Python2.7.14新手学习

    python2.7.14 让用户选择一个功能,然后对其进行操作的例子.中间有问题的是年龄没有做是否是数字判断 注意:和版本python3不同的地方 1.编码 2.输入地方是raw_input 3.业务 ...

  3. Changing the Language Used in ODI Studio

    odi.conf中加入区域和语言设置 修改 "$ODI_HOME\odi\studio\bin\odi.conf"    ( D:\Oracle\Middleware\Oracle ...

  4. JUC-线程池调度-ScheduledThreadPool

    线程调度使用类:ScheduledExecutorService 创建线程池调度类对象: ScheduledExecutorService pool = Executors.newScheduledT ...

  5. adb shell中的am pm命令

    adb shell中的am pm命令,一些自己的见解和大多数官网的翻译. am命令 am全称activity manager,你能使用am去模拟各种系统的行为,例如去启动一个activity,强制停止 ...

  6. ios中 radioButton和DataPIcker,九宫格封装好使用

    下载地址 http://pan.baidu.com/share/link?shareid=2894506499&uk=923776187 引用这几个文件 radiobutton.封装好单选按钮 ...

  7. commit your changes or stash them before you can merge

    今天用git pull来更新代码,遇到了下面的问题: 今天git pull 出现以下问题 Please commit your changes or stash them before you mer ...

  8. Java爬虫框架调研

    Python中大的爬虫框架有scrapy(风格类似django),pyspider(国产python爬虫框架). 除了Python,Java中也有许多爬虫框架. nutch apache下的开源爬虫程 ...

  9. zabbix主动被动模式说明/区别

    说明:使用zabbix代理有很多好处,一方面可以监控不可达的远程区域:另一方面当监控项目数以万计的时候使用代理可以有效分担zabbix server压力,也简化分布式监控的维护. 具体:主动.被动模式 ...

  10. 【Android】Android六种布局详解

    这篇就对LinearLayout.RelativeLayout.自定义ViewGroup.FrameLayout.TableLayout.AbsoluteLayout六种布局进行详细的讲解. 1.Li ...