Briefly, this error occurs when Elasticsearch attempts to parse a time value but encounters an unexpected data type, such as an object or an array, instead of a string or null value. To resolve this issue, ensure that the time value being passed is either a string in the correct format or a null value. Check your data input or the script that generates this data. If you’re using a date formatter, verify that it’s producing the correct output. Also, ensure that your mapping is correctly set to handle date or time fields.
This guide will help you check for common problems that cause the log ” could not parse time value. expected either a string or a null value but found [{}] ” to appear. To understand the issues related to this log, read the explanation below about the following Elasticsearch concepts: plugin.
Log Context
Log “could not parse time value. expected either a string or a null value but found [{}]” class name is WatcherDateTimeUtils.java. We extracted the following from Elasticsearch source code for those seeking an in-depth context :
} catch (ElasticsearchParseException epe) { throw new ElasticsearchParseException("failed to parse time unit"; epe); } } throw new ElasticsearchParseException("could not parse time value. expected either a string or a null value but found [{}] " + "instead"; token); } /** * Parse a {@link TimeValue} with support for fractional values.