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相关推荐

  1. 【Elasticsearch】es Ingest 节点

    1.概述 1.1 问题引出 来自星球同学的提问: "Ingest node什么场景会遇到它? 一直没搜到它是在什么场景工作的?" 的确我们比较关心集群的节点角色的划分.包括: 集群 ...

  2. Elasticsearch:ingest pipelines - 使用技巧和窍门

    在今天的文章中,我将列举一些例子来讲述使用 Elasticsearch ingest pipeline (摄取管道)的一些技巧.这些技巧虽然简单,但是在很多的应用场景中还是非常实用的.更多关于 ing ...

  3. 【Elasticsearch】es node 节点

    1.概述 [Elasticsearch]es如何停用节点 [ES]ES 如何在一个机器上同时模拟多个node [elasticsearch]elasticsearch集群更换节点操作 [Elastic ...

  4. Elasticsearch:Ingest pipeline 介绍

    Ingest pipeline 可让你在索引之前对数据执行常见转换. 例如,你可以使用 pipeline 删除字段.从文本中提取值并丰富你的数据. Pipeline 由一系列称为处理器(process ...

  5. Elasticsearch:Ingest Pipeline 实践

    相比较 Logstash 而言,由于其丰富的 processors 而受到越来越多人的喜欢.最重要的一个优点就是它基于 Elasticsearch 极具可拓展性和维护性而受到开发者的喜欢.我在之前创建 ...

  6. filebeat收集日志到elsticsearch中并使用ingest node的pipeline处理

    filebeat收集日志到elsticsearch中 一.需求 二.实现 1.filebeat.yml 配置文件的编写 2.创建自定义的索引模板 3.加密连接到es用户的密码 1.创建keystore ...

  7. 安装独立的 Elastic Agents 并采集数据 - Elastic Stack 8.0

    注意:在独立模式(standalone)下运行 Elastic Agent 是一个高级用例. 文档不完整,还不成熟. 如果可能,我们建议使用 fleet 管理的代理而不是独立模式. 要在独立模式下运行 ...

  8. Elasticsearch:使用 Filebeat 从 Node.js Web 应用程序提取日志

    本指南演示了如何从 Node.js Web 应用程序中提取日志并将它们安全地传送到 Elasticsearch Service 部署中. 你将设置 Filebeat 来监控具有标准 Elastic C ...

  9. 官方文档-丰富你的数据

    对应7.16官方文档路径: Ingest pipelines » Enrich your data 官方地址如下: https://www.elastic.co/guide/en/elasticsea ...

最新文章

  1. 2022-2028年中国场景金融行业深度调研及投资前景预测报告
  2. 自监督学习(Self-Supervised Learning)多篇论文解读(上)
  3. gem是什么证书_什么是GIA钻石?
  4. 线程池之工作项,等待项,计时项 (存在疑问???)
  5. 剩余 大小 查看内存_计算机内存管理介绍
  6. WARNING:Your password has expired --linux 用户密码过期
  7. 程序语言的奥妙:算法解读 ——读书笔记
  8. gm怎么刷东西 rust_Rust语言:解引用详述,搞不明白这个概念,趁早放弃Rust
  9. 从二进制数据流中构造GDAL可以读取的图像数据
  10. 为什么都建议学java而不是python-为什么入门大数据选择Python而不是Java?
  11. 海康威视工业相机使用
  12. weblogic部署静态资源文件html,weblogic部署静态html
  13. 好用的自媒体爆文素材采集技巧,提高爆文创作几率
  14. 使用DirectoryEntry进行 IIS 操作
  15. 25G差分信号对内等长相差太大怎么处理?在哪里绕好一点
  16. 租用云服务器价格表:阿里云和腾讯云服务器最新价格表
  17. 优化js脚本设计,防止浏览器假死
  18. maven不同环境引用不同版本的jar包依赖
  19. linux服务器无法解析域名解决办法,Linux服务器内部无法解析域名
  20. iOS字体大小适配机型的几种方法

热门文章

  1. linux deploy镜像容量扩容
  2. 抖音小店在哪里登录?抖音店怎么运营?
  3. 珍贵数学文献(II)
  4. 社会化商业的基础架构
  5. Python3 正则表达式
  6. 小程序中将lees转成wxss
  7. winXp 共享打印问题处理方法(终极版)
  8. 打印菱形图案用java如何做_Java打印出菱形图案
  9. 设备扩展(DEVICE_EXTENSION)
  10. html中的字体样式