美文网首页
016 pipeline管道

016 pipeline管道

作者: zhu733756 | 来源:发表于2020-04-01 19:03 被阅读0次

#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."

      }

    }

  ]

}

相关文章

网友评论

      本文标题:016 pipeline管道

      本文链接:https://www.haomeiwen.com/subject/yaaauhtx.html