Skip to content

Conversation

@danhermann
Copy link
Contributor

Adds a new type to the convert processor that validates IPv4/IPv6 addresses. Useful for guaranteeing that a particular field value can be mapped to an Elasticsearch ip field type. This is similar to the Beats processor functionality (described here) in which "the convert processor supports a psuedo-type for IPs. It doesn't really change the data type, but it will fail the "conversion" if the value is not an IP."

E.g.:

PUT _ingest/pipeline/ip_convert
{
  "processors": [
    {
      "convert": {
        "field": "source",
        "target_field": "source_ip",
        "type": "ip",
        "ignore_failure": true
      }
    }
  ]
}
# does not populate source_ip because invalid IP
POST /my-ip-test/_doc?pipeline=ip_convert
{
    "source" : "not_a_valid_ip"
}

# results in the following document (does not fail ingest pipeline because ignore_failure is set to true):
{
    "source" : "not_a_valid_ip"
}
# does populate source_ip because valid IP
POST /my-ip-test/_doc?pipeline=ip_convert
{
    "source" : "192.168.1.2"
}

# results in the following document (note that source_ip is still a string value):
{
    "source" : "192.168.1.2",
    "source_ip" : "192.168.1.2"
}

Resolves #36145

Backport of #69989

@danhermann danhermann added >feature :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP backport v7.13.0 labels Apr 5, 2021
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Apr 5, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features (Team:Core/Features)

@danhermann
Copy link
Contributor Author

@elasticmachine update branch

@danhermann danhermann merged commit dc5cc1c into elastic:7.x Apr 5, 2021
@danhermann danhermann deleted the backport_7x_69989_convert_ip branch April 5, 2021 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport :Data Management/Ingest Node Execution or management of Ingest Pipelines including GeoIP >feature Team:Data Management Meta label for data/management team v7.13.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants