ingest使用场景:
1、数据写入预处理
2、更新数据
3、重建索引数据
4、通用公用函数功能模块
processors:内置pipeline支持的数据加工处理器
set:使用结合来增加数据
DELETE _ingest/pipeline/area_01
PUT _ingest/pipeline/area_01
{
"description": "增加地区",
"processors": [
{
"set": {
"field": "country",
"value": "CN"
}
},
{
"set": {
"field": "provice",
"value": "zj"
}
},
{
"set": {
"field": "city",
"value": "hz"
}
}
]
}
GET _ingest/pipeline/area_01
PUT test_ingest/_doc/1?pipeline=area_01
{
"companyId":1,
"companyName":"##集团"
}
GET test_ingest/_search
GET test_ingest/_search结果:
{
"took" : 0,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "test_ingest",
"_type" : "_doc",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"country" : "CN",
"companyId" : 1,
"city" : "hz",
"companyName" : "##集团",
"provice" : "zj"
}
}
]
}
}
_simulate模拟器
POST _ingest/pipeline/area_01/_simulate
{
"docs": [
{
"_source":{
"name":"lisi"
}
}
]
}
结果:
{
"docs" : [
{
"doc" : {
"_index" : "_index",
"_type" : "_doc",
"_id" : "_id",
"_source" : {
"country" : "CN",
"city" : "hz",
"provice" : "zj",
"name" : "lisi"
},
"_ingest" : {
"timestamp" : "2021-01-19T14:18:32.554Z"
}
}
}
]
}
网友评论