Index fails for first document in the index despite ignore_malformed being set

If the first record being indexed has a date field in the record, and the first occurrence of that field is a valid date, such that Elasticsearch maps the type of the field to date, then later in the same record there is an occurrence of that same field but with an invalid date, index fails with the following reason:

mapper date.field.path of different type, current_type date, merged_type text

This error doesn't happen if the first record indexed has no invalid date, but a subsequent record with an invalid date is indexed. In that case, the ignore_malformed setting works, and Elasticsearch correctly omits that field.

But it doesn't work if the invalid field is in the first document being indexed. This seems to be a bug.

As far as I can tell, the only way to avoid this kind of error is create an index mapping setting that field's type to text before indexing. That's a reasonable solution, but I still feel like ignore_malformed should capture this case.

You're right, it probably guessed the wrong type for the field when schema was automatically created for you. so, your solution of manually defining schema should work

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