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'" //更新普通字段 } }
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【译】Visual Studio 中新的强大生产力特性
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决
2010-02-27 怎样让sqlserver后台定时执行某个存储过程?