ignore_malformed
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud. Availability This functionality is generally available and ready for production usage. Serverless interfaces and procedures might differ from classic Elastic Stack deployments. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability This functionality is generally available and ready for production usage. Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments. This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Serverless
Generally available
Stack
Generally available
Sometimes you don’t have much control over the data that you receive. One user may send a login field that is a date, and another sends a login field that is an email address.
Trying to index the wrong data type into a field throws an exception by default, and rejects the whole document. The ignore_malformed parameter, if set to true, allows the exception to be ignored. The malformed field is not indexed, but other fields in the document are processed normally.
For example:
PUT my-index-000001{ "mappings": { "properties": { "number_one": { "type": "integer", "ignore_malformed": true }, "number_two": { "type": "integer" } } } }PUT my-index-000001/_doc/1{ "text": "Some text value", "number_one": "foo" }PUT my-index-000001/_doc/2{ "text": "Some text value", "number_two": "foo" }
- This document will have the
textfield indexed, but not thenumber_onefield. - This document will be rejected because
number_twodoes not allow malformed values.
The ignore_malformed setting is currently supported by the following mapping types:
- Numeric
long,integer,short,byte,double,float,half_float,scaled_float- Boolean
boolean- Date
date- Date nanoseconds
date_nanos- Geopoint
geo_pointfor lat/lon points, although there is a special case for out-of-range values- Geoshape
geo_shapefor complex shapes like polygons- IP
ipfor IPv4 and IPv6 addresses
The ignore_malformed setting value can be updated on existing fields using the update mapping API.
The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.
Availability
Planned
We plan to add this functionality in a future Elastic Stack update. Subject to changes.
Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments.
This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.
Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud.
Availability
Preview
This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply.
Serverless interfaces and procedures might differ from classic Elastic Stack deployments.
In columnar index modes, malformed values are stored in the field's hidden <field>._on_failure column rather than a separate ._ignore_malformed column, so they share one sidecar column with doc_values constraint violations. This applies regardless of the field's on_failure setting. The field name is still recorded in _ignored. Columnar indices created before 9.6 keep reading and writing their existing ._ignore_malformed column after upgrade.
The index.mapping.ignore_malformed setting can be set on the index level to ignore malformed content globally across all allowed mapping types. Mapping types that don’t support the setting will ignore it if set on the index level.
PUT my-index-000001{ "settings": { "index.mapping.ignore_malformed": true }, "mappings": { "properties": { "number_one": { "type": "byte" }, "number_two": { "type": "integer", "ignore_malformed": false } } } }
- The
number_onefield inherits the index-level setting. - The
number_twofield overrides the index-level setting to turn offignore_malformed.
Malformed fields are silently ignored at indexing time when ignore_malformed is turned on.
Whenever possible it is recommended to keep the number of documents that have a malformed field contained,
or queries on this field will become meaningless.
Elasticsearch makes it easy to check how many documents have malformed fields by using exists,
term or terms queries on the special _ignored field.
With geo_point fields,
there is the special case of values that have a syntactically valid format,
but the numerical values for latitude and longitude are out of range.
If ignore_malformed is false, an exception will be thrown as usual. But if it is true,
the document will be indexed correctly, by normalizing the latitude and longitude values into the valid range.
The special _ignored field will not be set.
The original source document will remain as before, but indexed values, doc-values and stored fields will all be normalized.
You can’t use ignore_malformed with the following data types:
You also can’t use ignore_malformed to ignore JSON objects submitted to fields of the wrong data type. A JSON object is any data surrounded by curly brackets "{}" and includes data mapped to the nested, object, and range data types.
If you submit a JSON object to an unsupported field, Elasticsearch will return an error and reject the entire document regardless of the ignore_malformed setting.