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 ...
随机推荐
- Container [pid=6263,containerID=container_1494900155967_0001_02_000001] is running beyond virtual memory limits
以Spark-Client模式运行,Spark-Submit时出现了下面的错误: User: hadoop Name: Spark Pi Application Type: SPARK Applica ...
- RN组件备忘录
1:ActivityIndicator:圆形的loading提示符号. 2:Button:按钮 3:FlatList:高性能列表组件,支持下拉刷新. 4:Image:图片组件,能显示 网络图片.静态资 ...
- Ajax实现文件上传的临时垃圾文件回收策略
转载请注明原文出处:http://www.cnblogs.com/ygj0930/p/6126240.html 在我们web开发过程中,一个很重要的技术就是Ajax(异步传输).Ajax通过把数据从网 ...
- CentOS 7 安装php5.6,Nginx,Memcached环境及配置
安装php5.6版本以后不再需要安装Zend Guard,而是用yum命令安装php-opcache及php-pecl-apcu就可以有效的提高php执行速度. 1. 配置yum源 事先确认yum源的 ...
- SUMIF
SUMIF(range,criteria,sum_range) Range:条件区域,用于条件判断的单元格区域. Criteria:求和条件,由数字.逻辑表达式等组成的判定条件.criteria 参数 ...
- 安装win和xp双系统 若干问题
装了winxp和linux双系统,后先在winxp下手动格式化了linux系统,后启动时提示grub错误,重新分区后系统也 2010-09-17 21:07 [清风剑] | 分类:Linux | 浏览 ...
- 重装wordpress
1.删除wordpress: https://blog.csdn.net/yeqinghanwu/article/details/77916912 2.uninstall lnmp 3.安装lnmp ...
- App 开发步骤
在 iOS 开发中,写一个 App 很容易,但是要写好一个 App,确是要下另一番功夫.首先,我们来看一个 App 的开发要求: 写一个 App,显示出 Spotify 上 Lady Gaga 相关的 ...
- 【LeetCode】221. Maximal Square
Maximal Square Given a 2D binary matrix filled with 0's and 1's, find the largest square containing ...
- 【LeetCode】174. Dungeon Game
Dungeon Game The demons had captured the princess (P) and imprisoned her in the bottom-right corner ...