Getting error while posting ip address documents in elastic?

40 views Asked by At

I have IPv6 in decimal format, I am trying to convert it into the ip addresses then converting the start and end ip addresses into CIDR notation using PowerShell.

Sample Data:

startIP: "281470698520851"
endIP: "281470698520851"

Result:

ipv6-range: "::ffff:1.0.1.19/128"

JSON Data for elastic:

{"index":{"_index":"enrich-data-ipv6-range-vpn","_id":"ffff10119128"}}
{"startIP":"281470698520851","endIP":"281470698520851","ipv6-range":"::ffff:1.0.1.19/128"}

Index Mapping:

{
  "_doc": {
    "_routing": {
      "required": false
    },
    "dynamic": false,
    "_source": {
      "excludes": [],
      "includes": [],
      "enabled": true
    },
    "dynamic_templates": [],
    "properties": {
      "ipv6-range": {
        "type": "ip_range"
      }
    }
  }
}

I am using elastic bulk API to post the JSON data but getting below error

"reason": "CIDR notation is not allowed with IPv6-mapped IPv4 address '::ffff:1.0.1.19' as it introduces ambiguity as to whether the prefix length should be interpreted as a v4 prefix length or a v6 prefix length"

Could someone help me converting the ipv6 into correct format.

0

There are 0 answers