016 pipeline管道
#pipeline,数据处理管道
PUT _ingest/pipeline/blog_pipeline
{
"description": "a blog pipeline",
"processors": [
{
"split": {
"field": "tags",
"separator": ","
}
},
{
"set": {
"field": "views",
"value": 0
}
}
]
}
GET _ingest/pipeline/blog_pipeline
POST _ingest/pipeline/blog_pipeline/_simulate
{
"docs": [
{
"_source": {
"title": "introducing cload computering",
"tags": "openstack,k8s"
}
}
]
}
DELETE test_blog
PUT test_blog/_doc/1
{
"title": "introducing cload computering",
"tags": "openstack,k8s"
}
PUT test_blog/_doc/2
{
"title": "introducing cload computering",
"tags": "openstack,k8s"
}
POST test_blog/_search
{
"size": 20
}
POST test_blog/_search
{
"size":10
}
#管道与脚本语言
POST _ingest/pipeline/_simulate
{
"pipeline": {
"description": "a test pipeline",
"processors": [
{
"set": {
"field": "views",
"value": 0
},
"script":{
"source": """
if(ctx.containsKey("body")){
ctx.body_count = ctx.body.length();
} else {
ctx.body_count = 0;
}"""
}
}
]
},
"docs": [
{
"_source": {
"title": "Keeping pets healthy",
"body": "My quick brown fox eats rabbits on a regular basis."
}
}
]
}