June 2017
Beginner to intermediate
404 pages
8h 22m
English
The date data type is used to represent date fields in Elasticsearch. In JSON, the date fields are passed as a string. To parse the date correctly, you should tell Elasticsearch how the date string is formatted. If no format is specified, Elasticsearch tries to parse the date field using the yyyy-MM-dd'T'HH:mm:ssz format, also known as strict_date_optional_time, which requires date and optional time.
An example document is shown as follows:
{ "creation_date": "2017-01-01", "desc": "Yosemite national park may be closed for the weekend due to forecast of substantial rainfall" }
You can tell Elasticsearch how creation_date is formatted in the mapping, as shown next:
PUT chapter3/_mapping/news { "properties": { "creation_date": { "type": ...Read now
Unlock full access