Skip to content

Parsing of "ZZZ" component in date formats fails #20911

@yrodiere

Description

@yrodiere

Elasticsearch version: 2.4.1
Used to work in 2.3.1.

Plugins installed: none

JVM version: java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)

OS version: Fedora 24

Description of the problem including expected versus actual behavior:

Parsing of "ZZZ" component in date formats seems to fail for some formats. I don't know what exactly triggers the issue, but having a literal just before the "ZZZ" component seems to be enough.

I managed to reproduce the bug in Joda-time 2.9.4 directly. There seems to be a fix in master, but it has not been released yet.

The next release of Elasticsearch on the 2.4 branch should upgrade the Joda dependency to fix this bug.

Steps to reproduce:

  1. Launch an Elasticsearch node on localhost:9200
  2. Execute the following bash script:
curl -XPUT 'localhost:9200/testindex/?pretty'
curl -XPUT 'localhost:9200/testindex/testtype/_mapping?pretty' -d'{"properties":{"zonedDate":{"type":"date","store":true,"format":"yyyy-MM-dd'['ZZZ']'"}}}'
curl -XPUT 'localhost:9200/testindex/testtype/1?pretty' -d'{"zonedDate":"2016-10-13[CET]"}'

Provide logs (if relevant):
Elasticsearch response for the last command:

{
  "error" : {
    "root_cause" : [ {
      "type" : "mapper_parsing_exception",
      "reason" : "failed to parse [zonedDate]"
    } ],
    "type" : "mapper_parsing_exception",
    "reason" : "failed to parse [zonedDate]",
    "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "Invalid format: \"2016-10-13[CET]\" is malformed at \"CET]\""
    }
  },
  "status" : 400
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search Foundations/MappingIndex mappings, including merging and defining field types>bugTeam:Search FoundationsMeta label for the Search Foundations team in Elasticsearch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions