# Ignore malformed for date

**URL:** <https://discuss.elastic.co/t/ignore-malformed-for-date/80978>\
**Category:** Elasticsearch\
**Created:** [April 3, 2017, 10:05am UTC](https://discuss.elastic.co/t/ignore-malformed-for-date/80978 "2017-04-03T10:05:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gsb](https://avatars.discourse-cdn.com/v4/letter/g/cc9497/32.png) [@gsb](https://discuss.elastic.co/u/gsb)\
**Post date:** [April 3, 2017, 10:05am UTC](https://discuss.elastic.co/t/ignore-malformed-for-date/80978/1 "2017-04-03T10:05:16Z")

</div>

In Elastic

for field of type date , even if the ignore malformed attribute is set to true , it indexes the malformed data into this field.

Ideally this field value should be empty in case the incoming data is malformed.

---

<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:** [April 3, 2017, 10:20am UTC](https://discuss.elastic.co/t/ignore-malformed-for-date/80978/2 "2017-04-03T10:20:55Z")

</div>

Can you send a script which reproduce your issue? Including mapping creation...

---

<div class="post-metadata">

**Author:** ![gsb](https://avatars.discourse-cdn.com/v4/letter/g/cc9497/32.png) [@gsb](https://discuss.elastic.co/u/gsb)\
**Post date:** [April 3, 2017, 10:29am UTC](https://discuss.elastic.co/t/ignore-malformed-for-date/80978/3 "2017-04-03T10:29:08Z")

</div>

Index Creation as follows :

curl -XPUT "[http://localhost:9200/testindex?pretty](http://localhost:9200/testindex?pretty)" -d'  
{  
"mappings": {  
"testmapping" : {  
"properties": {  
"date": {"format": "strict\_date\_optional\_time", "ignore\_malformed": true, "type": "date" }  
}  
}  
}  
}  
'

insert data as follows :

curl -XPOST localhost:9200/testindex/testmapping -d '{  
"date" : "8.1/10"  
}'

As a result of above data gets indexed , ideally the field value should be empty as it's malformed.

---

<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:** [April 3, 2017, 10:50am UTC](https://discuss.elastic.co/t/ignore-malformed-for-date/80978/4 "2017-04-03T10:50:43Z")

</div>

But I'm sure you can't search for that field.

The field actually has not been indexed. You can still see it in the `_source` field because we don't modify what you are sending but it does not mean that the field has been indexed.

---

<div class="post-metadata">

**Author:** ![gsb](https://avatars.discourse-cdn.com/v4/letter/g/cc9497/32.png) [@gsb](https://discuss.elastic.co/u/gsb)\
**Post date:** [April 3, 2017, 10:56am UTC](https://discuss.elastic.co/t/ignore-malformed-for-date/80978/5 "2017-04-03T10:56:11Z")

</div>

I can search the document using

[http://localhost:9200/testindex/\_search?pretty=true&q=](http://localhost:9200/testindex/_search?pretty=true&q=)_:_

1. When you say the field has not been indexed , can you please elaborate?
2. Does ignore\_malformed to true, does that not mean data will not be stored into that field if it's malformed ?

---

<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:** [April 3, 2017, 11:27am UTC](https://discuss.elastic.co/t/ignore-malformed-for-date/80978/6 "2017-04-03T11:27:59Z")

</div>

The document is indexed. All fields but this one are indexed. If you want to reject the whole document don't set the ignore malformed setting

---

<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:** [May 1, 2017, 11:28am UTC](https://discuss.elastic.co/t/ignore-malformed-for-date/80978/7 "2017-05-01T11:28:15Z")

</div>

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