how to set a default value based on certain criteria?

Created on 7 March 2024, 10 months ago
Updated 26 March 2024, 9 months ago

Problem/Motivation

hey everyone, seems like I cannot conditionally insert default values for missing or invalid latitude and longitude when importing data into Elasticsearch via the module. This results in failed entries due to invalid geo-type fields.

I create a custom plugin that checks lat/long values(in my scenario) against a regex. If invalid, it inserts a default value; otherwise, it uses the value from the previous plugin.

  transforms:
    record:
      - plugin: concat
        fields:
          - lat
          - long
        as: location
        separator: ','
      - plugin: default_value
        regex: '/^,+$/'
        field: location
        value: null
Feature request
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

🇦🇺Australia yovince Melbourne

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024