DisplayName
DisplayName

Reputation: 533

Auto-detect dates when dynamically creating ElasticSearch indexes

I've just started using the rest api to put documents into ElasticSearch having always used Logstash to do this in the past.

How do I get ES to recognise dates when I pass it a string or integer? I've tried both 13 digit "millis since epoc" (as string and integer) format and yyyyMMddTHHmmss.SSSZ (ISO 8601) format. Neither seem to get parsed.

Looking at documents that Logstash has successfully indexed, it seems to use the "millis since epoc" method, and I know those indexes are dynamically created. Submitting mappings for each index is not an option for me.

Any ideas? Thanks.

Upvotes: 1

Views: 1998

Answers (1)

SurrealAnalysis
SurrealAnalysis

Reputation: 303

Date detection is covered in detail in the dynamic field mapping section of the documentation.

By default, either yyyy/MM/dd HH:mm:ss Z or yyyy/MM/dd Z can be used, but you can customize that further on a per-index basis if you want.

Upvotes: 2

Related Questions