Using a search template in an ingest pipeline

前端 未结 2 671
Happy的楠姐
Happy的楠姐 2020-12-12 07:55

Can an ElasticSearch ingest pipeline use a search template as its script?

Specifically, I\'d like to configure an ingest pipeline so that whenever data of a particul

2条回答
  •  囚心锁ツ
    2020-12-12 08:30

    So the ingest script pipeline is already the combination your looking for, you should use the if option, read about it here.

    Your pipeline should look something like this:

    {
        "script": {
            "if": "ctx.type == 'thisType'",
            "source": """
                      //calculation here
                      ctx.newField = value;
                      """
        }
    }
    

    I recommend after you create your pipeline you test it using simulate as it will make your life much easier.

    EDIT:

    Thanks to @val that cleared up some confusion on my part. So you can't really do exactly what you want however i recommend you read about enrich pipeline. with some setup you might be able to make it happen.

提交回复
热议问题