I have a production index with a date type field, which causes the error of Field [tagSet.items.value] of type [text] does not support custom formats in Kibana.
I've created another index for test and whenever I want to POST a document with a text type instead a of date type, it prevents indexing the document and shows this error: mapper_parsing_exception
I'm wondering how this didn't happen on my production index, if Elasticsearch had prevented indexing the document with wrong type values I wouldn't had any problems.
Is there any way to PREVENT Elasticsearch to accept documents with different types for a field?
Elasticsearch allows you to define mappings in index templates.You can there specify that your field is a date and that will be enforced. If you try to insert a text value that can not be parsed as a date you will get a mapper error.
If you do not have an index template with mapping for the field in place, Elasticsearch will try to deduce the type based on the first document it encounters with this field. It will at that point depend on the data which type the field is mapped as. If it happens to be a date it could be set to date and if it is some other string it would be mapped as text. From that point on that field type will be validated. If the field was mapped as text it will accept any string and you will not see errors. If it was mapped as date you would see errors for non-compatible strings.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.