Skip to content

HTTP 500 response to invalid dynamic_mappings syntax #51486

@jowiho

Description

@jowiho

Elasticsearch version: 7.5.2

Plugins installed: []

JVM version: (Elastic Cloud)

OS version: (Elastic Cloud)

Description of the problem including expected versus actual behavior:

Actual behavior: An (invalid) mappings update request, where dynamic_mappings is an object instead of an array, results in a http response with a 500 code.

Expected behavior: A 400 (bad request) http response code.

Steps to reproduce:

  1. Create a new index my_index
  2. Send the following request through Kibana's console
PUT /my_index/_mappings
{
  "dynamic_templates": {}
}
  1. Notice the 500 response:
{
  "error": {
    "root_cause": [
      {
        "type": "class_cast_exception",
        "reason": "class java.util.LinkedHashMap cannot be cast to class java.util.List (java.util.LinkedHashMap and java.util.List are in module java.base of loader 'bootstrap')"
      }
    ],
    "type": "class_cast_exception",
    "reason": "class java.util.LinkedHashMap cannot be cast to class java.util.List (java.util.LinkedHashMap and java.util.List are in module java.base of loader 'bootstrap')"
  },
  "status": 500
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions