es-Ingest pipelines
Ingest pipelines
node为ingest角色,对indexing request做预处理,主要用于数据转换为合规、期望值的场景
官方地址:
https://www.elastic.co/guide/en/elasticsearch/reference/7.13/ingest.html#ingest
使用pipeline必要条件
node角色必须为:ingest
pipeline的组成
{"description" : "...","processors" : [ ... ]
}
description:描述
processor: pipeline中的每个处理单元,pipeline的能力都由processor来提供
pipeline: es对indexing的doc做一些预处理的程序,pipeline可定义了很多个processor单元
pipeline的使用
1.创建pipeline
PUT _ingest/pipeline/my-pipeline
{"description": "My optional pipeline description","processors": [{"set": {"description": "My optional processor description","field": "my-long-field","value": 10}},{"lowercase": {"field": "my-keyword-field"}}]
}
2.测试pipeline
对_source进行小写
POST _ingest/pipeline/my-pipeline/_simulate
{"docs": [{"_source": {"my-keyword-field": "FOO"}},{"_source": {"my-keyword-field": "BAR"}}]
}
pipeline的常用函数
Append:追加新值。
https://www.elastic.co/guide/en/elasticsearch/reference/7.13/append-processor.html
例如:创建一个tags,构成的规则为value的内容
{"append": {"field": "tags","value": ["production", "{{{app}}}", "{{{owner}}}"]}}
Foreach:
存储内容对象是数组、object类型,需要对数组每个元素做转换,就需要通过foreach出每个元素
https://www.elastic.co/guide/en/elasticsearch/reference/7.13/foreach-processor.html
例如:对values数组中每个元素做转大写操作
{"foreach" : {"field" : "values","processor" : {"uppercase" : {"field" : "_ingest._value"}}}
}
uppercase、Lowercase :
大小写转换
https://www.elastic.co/guide/en/elasticsearch/reference/7.13/uppercase-processor.html
https://www.elastic.co/guide/en/elasticsearch/reference/7.13/lowercase-processor.html
{"uppercase": {"field": "foo"}
}
Pipeline
https://www.elastic.co/guide/en/elasticsearch/reference/7.13/pipeline-processor.html
PUT _ingest/pipeline/my-pipeline{"processors": [{"set": {"field": "newadd","value": "{{value01}}.{{value02}}.{{value03}}.{{value04}}"}}]}POST task/_update_by_query?pipeline=my-pipeline
Remove
删除现有字段。如果某个字段不存在,则会引发异常。
https://www.elastic.co/guide/en/elasticsearch/reference/7.13/remove-processor.html
PUT _ingest/pipeline/my-pipeline{"processors": [{"remove": {"field": ["user_agent", "url"]}}]}
Rename
重命名现有字段。如果该字段不存在或已使用新名称,则会引发异常。
https://www.elastic.co/guide/en/elasticsearch/reference/7.13/rename-processor.html
PUT _ingest/pipeline/my-pipeline
{"processors": [{"rename": {"field": "provider","target_field": "cloud.provider"}}]
}
Script
https://www.elastic.co/guide/en/elasticsearch/reference/7.13/script-processor.html
PUT _ingest/pipeline/my-pipeline
{"processors": [{ "script": { "lang": "painless", "source": """ if (ctx.containsKey("batch_number")==true){ ctx.batch_number += 1; }else{ ctx.batch_number=1; } """ } }]
}
Set
https://www.elastic.co/guide/en/elasticsearch/reference/7.13/set-processor.html
PUT _ingest/pipeline/my-pipeline
{"processors": [{"set": {"field": "newadd","value": "{{value01}}.{{value02}}.{{value03}}.{{value04}}"}}]
}
Split
https://www.elastic.co/guide/en/elasticsearch/reference/7.13/split-processor.html
按指定分隔符分割字符串
PUT _ingest/pipeline/my-pipeline{"processors": [{"split": {"field": "my_field","separator": ",",}}]}
Trim
去除字符串field的空格
https://www.elastic.co/guide/en/elasticsearch/reference/7.13/trim-processor.html
PUT _ingest/pipeline/my-pipeline{"processors": [{"trim": {"field": "foo"}}]}
es-Ingest pipelines相关推荐
- 【Elasticsearch】es Ingest 节点
1.概述 1.1 问题引出 来自星球同学的提问: "Ingest node什么场景会遇到它? 一直没搜到它是在什么场景工作的?" 的确我们比较关心集群的节点角色的划分.包括: 集群 ...
- Elasticsearch:ingest pipelines - 使用技巧和窍门
在今天的文章中,我将列举一些例子来讲述使用 Elasticsearch ingest pipeline (摄取管道)的一些技巧.这些技巧虽然简单,但是在很多的应用场景中还是非常实用的.更多关于 ing ...
- 【Elasticsearch】es node 节点
1.概述 [Elasticsearch]es如何停用节点 [ES]ES 如何在一个机器上同时模拟多个node [elasticsearch]elasticsearch集群更换节点操作 [Elastic ...
- Elasticsearch:Ingest pipeline 介绍
Ingest pipeline 可让你在索引之前对数据执行常见转换. 例如,你可以使用 pipeline 删除字段.从文本中提取值并丰富你的数据. Pipeline 由一系列称为处理器(process ...
- Elasticsearch:Ingest Pipeline 实践
相比较 Logstash 而言,由于其丰富的 processors 而受到越来越多人的喜欢.最重要的一个优点就是它基于 Elasticsearch 极具可拓展性和维护性而受到开发者的喜欢.我在之前创建 ...
- filebeat收集日志到elsticsearch中并使用ingest node的pipeline处理
filebeat收集日志到elsticsearch中 一.需求 二.实现 1.filebeat.yml 配置文件的编写 2.创建自定义的索引模板 3.加密连接到es用户的密码 1.创建keystore ...
- 安装独立的 Elastic Agents 并采集数据 - Elastic Stack 8.0
注意:在独立模式(standalone)下运行 Elastic Agent 是一个高级用例. 文档不完整,还不成熟. 如果可能,我们建议使用 fleet 管理的代理而不是独立模式. 要在独立模式下运行 ...
- Elasticsearch:使用 Filebeat 从 Node.js Web 应用程序提取日志
本指南演示了如何从 Node.js Web 应用程序中提取日志并将它们安全地传送到 Elasticsearch Service 部署中. 你将设置 Filebeat 来监控具有标准 Elastic C ...
- 官方文档-丰富你的数据
对应7.16官方文档路径: Ingest pipelines » Enrich your data 官方地址如下: https://www.elastic.co/guide/en/elasticsea ...
最新文章
- 2022-2028年中国场景金融行业深度调研及投资前景预测报告
- 自监督学习(Self-Supervised Learning)多篇论文解读(上)
- gem是什么证书_什么是GIA钻石?
- 线程池之工作项,等待项,计时项 (存在疑问???)
- 剩余 大小 查看内存_计算机内存管理介绍
- WARNING:Your password has expired --linux 用户密码过期
- 程序语言的奥妙:算法解读 ——读书笔记
- gm怎么刷东西 rust_Rust语言:解引用详述,搞不明白这个概念,趁早放弃Rust
- 从二进制数据流中构造GDAL可以读取的图像数据
- 为什么都建议学java而不是python-为什么入门大数据选择Python而不是Java?
- 海康威视工业相机使用
- weblogic部署静态资源文件html,weblogic部署静态html
- 好用的自媒体爆文素材采集技巧,提高爆文创作几率
- 使用DirectoryEntry进行 IIS 操作
- 25G差分信号对内等长相差太大怎么处理?在哪里绕好一点
- 租用云服务器价格表:阿里云和腾讯云服务器最新价格表
- 优化js脚本设计,防止浏览器假死
- maven不同环境引用不同版本的jar包依赖
- linux服务器无法解析域名解决办法,Linux服务器内部无法解析域名
- iOS字体大小适配机型的几种方法