# Default Value for IP data type

**URL:** <https://discuss.elastic.co/t/default-value-for-ip-data-type/124547>\
**Category:** Elasticsearch\
**Created:** [March 19, 2018, 11:49am UTC](https://discuss.elastic.co/t/default-value-for-ip-data-type/124547 "2018-03-19T11:49:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patricia\_Narvasa](https://avatars.discourse-cdn.com/v4/letter/p/2bfe46/32.png) [@Patricia\_Narvasa](https://discuss.elastic.co/u/Patricia_Narvasa)\
**Post date:** [March 19, 2018, 11:49am UTC](https://discuss.elastic.co/t/default-value-for-ip-data-type/124547/1 "2018-03-19T11:49:59Z")

</div>

Hi,

I have this object with this mapping,  
"IpAddress": {  
"type": "ip",  
"index": "true",  
"null\_value": "NULL"  
},  
I tried to persist a document with this value: Ex: ipAddress=""  
It successfully persisted but I have this error on logs,

```
Stack Trace : 
org.elasticsearch.client.ResponseException: PUT http://localhost:9200/infor_auditlogentry_os: HTTP/1.1 400 Bad Request
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"Failed to parse mapping [objectentry]: 'NULL' is not an IP string literal."}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [objectentry]: 'NULL' is not an IP string literal.","caused_by":{"type":"illegal_argument_exception","reason":"'NULL' is not an IP string literal."}},"status":400}
at org.elasticsearch.client.RestClient$1.completed(RestClient.java:354)

```

I'm wondering why am I getting this error when I have successfully persisted my data.  
And also what is your suggested default value for IP datatypes?  
Is it "" or "0.0.0.0"

Thank you

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 19, 2018, 3:31pm UTC](https://discuss.elastic.co/t/default-value-for-ip-data-type/124547/2 "2018-03-19T15:31:52Z")

</div>

Just remove this:

```auto
"null_value": "NULL"

```

From your mapping.

Then when you index a document just omit the field `IpAddress`.

My 2 cents

---

<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 16, 2018, 3:31pm UTC](https://discuss.elastic.co/t/default-value-for-ip-data-type/124547/3 "2018-04-16T15:31:56Z")

</div>

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