# IP datatype field cannot be created

**URL:** <https://discuss.elastic.co/t/ip-datatype-field-cannot-be-created/223368>\
**Category:** Logstash\
**Created:** [March 12, 2020, 3:33pm UTC](https://discuss.elastic.co/t/ip-datatype-field-cannot-be-created/223368 "2020-03-12T15:33:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sstnt783](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@sstnt783](https://discuss.elastic.co/u/sstnt783)\
**Post date:** [March 12, 2020, 3:33pm UTC](https://discuss.elastic.co/t/ip-datatype-field-cannot-be-created/223368/1 "2020-03-12T15:33:41Z")

</div>

Hi, i am trying to use map field as IP datatype but ending with getting string.

First i tried it (as i did for NUMBER data type) do it just by GROK parsing pattern that when in log, the value would be mapped by %{IP:sorc:ip} but this created string type field.

Then, i tried at kibana\>index template\>mappings\>mapping field, added "sorc1" as IP datatype, made the parser {IP:sorc1} but getting string, same when i tried to map it again in kibana index template mapping and in pattern defined %{IP:sorc2:ip}.

My index template:

```
{
  "logstashx" : {
    "order" : 0,
    "index_patterns" : [
      "logstashx-*"
    ],
    "settings" : { },
    "mappings" : {
      "_routing" : {
        "required" : false
      },
      "numeric_detection" : false,
      "dynamic_date_formats" : [
        "strict_date_optional_time",
        "yyyy/MM/dd HH:mm:ss Z||yyyy/MM/dd Z"
      ],
      "_meta" : { },
      "_source" : {
        "excludes" : [],
        "includes" : [],
        "enabled" : true
      },
      "dynamic" : true,
      "dynamic_templates" : [],
      "date_detection" : true,
      "properties" : {
        "sorc1" : {
          "type" : "ip"
        },
        "sorc2" : {
          "type" : "ip"
        }
      }
    },
    "aliases" : { }
  }
}

```

when i try to put:

```
   "sorc3" : {
  "full_name" : "sorc3",
  "mapping" : {
    "ip" : {
      "type" : "ip"
    }
  }
  },

```

under properties, i get error message:

```
{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_parsing_exception",
        "reason" : "No type specified for field [sorc3]"
      }
    ],
    "type" : "mapper_parsing_exception",
    "reason" : "Failed to parse mapping [_doc]: No type specified for field [sorc3]",
    "caused_by" : {
      "type" : "mapper_parsing_exception",
      "reason" : "No type specified for field [sorc3]"
    }
  },
  "status" : 400
} 

```

I tought i was mapping it correctly, but none of tried methods worked, any ideas what i am doing wrong?

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [March 12, 2020, 5:13pm UTC](https://discuss.elastic.co/t/ip-datatype-field-cannot-be-created/223368/2 "2020-03-12T17:13:19Z")

</div>

You'll get better answers in the Logstash discuss forum than the Kibana one. I recommend asking there.

---

<div class="post-metadata">

**Author:** ![sstnt783](https://avatars.discourse-cdn.com/v4/letter/s/48db29/32.png) [@sstnt783](https://discuss.elastic.co/u/sstnt783)\
**Post date:** [April 2, 2020, 1:16pm UTC](https://discuss.elastic.co/t/ip-datatype-field-cannot-be-created/223368/3 "2020-04-02T13:16:41Z")

</div>

Seems like creating index mapping by

```
PUT logstashx
{
  "mappings": {
      "properties": {
        "sorc3": {
          "type": "ip"
        }
      }
    }
  }

```

was sufficient.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [April 30, 2020, 1:16pm UTC](https://discuss.elastic.co/t/ip-datatype-field-cannot-be-created/223368/4 "2020-04-30T13:16:43Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
