#pipeline,數(shù)據(jù)處理管道
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."
? ? ? }
? ? }
? ]
}