Skip to content

Formats date_optional_time and dateOptionalTime are no longer interchangeable #57672

Closed
@kstevens715

Description

@kstevens715

Elasticsearch version (bin/elasticsearch --version): 7.7.1 and 7.6.2. I'm currently using Docker with image: docker.elastic.co/elasticsearch/elasticsearch:7.7.1

Plugins installed: []

JVM version (java -version): Returns nothing in Docker container.

OS version (uname -a if on a Unix-like system): Linux 1a0ec47b8a82 4.19.76-linuxkit #1 SMP Tue May 26 11:42:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:

You update a date format mapping from "dateOptionalTime" to "date_optional_time".

Expected: As in 7.5.2, the update is successful since both format strings are interchangeable.
Actual: In 7.6.2 and 7.7.1, an error is raised about "conflicts with existing mapping" (see below).

We always update mappings with "dateOptionalTime" but the mappings somehow got changed to "date_optional_time" recently (probably when upgrading from 7.5.2 -> 7.6.2). We ran into this error when updating mappings as we usually do.

Steps to reproduce:

curl -XDELETE localhost:9200/test
curl -XPUT localhost:9200/test
curl -XPUT localhost:9200/test/_mapping -H 'Content-Type: application/json' -d'{  "properties": {    "created_at": {      "type": "date",      "format": "dateOptionalTime"    }  }}'
curl -XPUT localhost:9200/test/_mapping -H 'Content-Type: application/json' -d'{  "properties": {    "created_at": {      "type": "date",      "format": "date_optional_time"    }  }}'

Error on last command:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": """Mapper for [created_at] conflicts with existing mapping:
[mapper [created_at] has different [format] values]"""
      }
    ],
    "type": "illegal_argument_exception",
    "reason": """Mapper for [created_at] conflicts with existing mapping:
[mapper [created_at] has different [format] values]"""
  },
  "status": 400
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Core/Infra/CoreCore issues without another label:Search Foundations/MappingIndex mappings, including merging and defining field types>bugTeam:Core/InfraMeta label for core/infra teamTeam:Search FoundationsMeta label for the Search Foundations team in Elasticsearchneeds:triageRequires assignment of a team area label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions