《Elastic Stack 实战手册》——三、产品能力——3.4.入门篇——3.4.2.Elasticsearch基础应用——3.4.2.15.ingest pipelines(2) https://developer.aliyun.com/article/1230172
Lowercase / Uppercase
将字符串修改为大写或者小写:
PUT _ingest/pipeline/lowercase_pipeline { "description": "lowercase processor", "processors": [ { "lowercase": { "field": "message" } } ] } #测试,部分字符大写 POST _ingest/pipeline/lowercase_pipeline/_simulate { "docs": [ { "_source": { "message": [ "CAr222 aaa", " auto2222 aaaa Bbb" ] } } ] } #结果,全部输出为小写 { "docs" : [ { "doc" : { "_index" : "_index", "_type" : "_doc", "_id" : "_id", "_source" : { "message" : [ "car222 aaa", " auto2222 aaaa bbb" ] }, "_ingest" : { "timestamp" : "2021-04-28T15:12:10.041308Z" } } } ] }
Remove
移除已经存在的字段:
#定义remove pipelint PUT _ingest/pipeline/remove_pipeline { "description": "remove processor", "processors": [ { "remove": { "field": "message" } } ] } #测试 POST _ingest/pipeline/remove_pipeline/_simulate { "docs": [ { "_source": { "message": [ "CAr222 aaa", " auto2222 aaaa Bbb" ] } } ] } #返回,可以看到message字段已经被移除 { "docs" : [ { "doc" : { "_index" : "_index", "_type" : "_doc", "_id" : "_id", "_source" : { }, "_ingest" : { "timestamp" : "2021-04-28T15:15:27.811516Z" } } } ] }
Set
给已有字段进行赋值:
PUT _ingest/pipeline/set_pipeline { "description": "set processor", "processors": [ { "set": { "field": "message", "value": "this is a new message" } } ] } POST _ingest/pipeline/set_pipeline/_simulate { "docs": [ { "_source": { "message": "this" } } ] } #返回 { "docs" : [ { "doc" : { "_index" : "_index", "_type" : "_doc", "_id" : "_id", "_source" : { "message" : "this is a new message" }, "_ingest" : { "timestamp" : "2021-04-28T15:21:28.928512Z" } } } ] }
《Elastic Stack 实战手册》——三、产品能力——3.4.入门篇——3.4.2.Elasticsearch基础应用——3.4.2.15.ingest pipelines(4) https://developer.aliyun.com/article/1230170