Skip to content

get_mappings tool fails with "error decoding response body" when nested type is omitted in properties #185

@NavaneethaKannan

Description

@NavaneethaKannan

When using the get_mappings tool, the server throws "Request failed (remote): error decoding response body" if a nested property is defined without explicitly specifying "type": "nested", even though the mapping is valid according to Elasticsearch specifications.

Example Mapping That Fails:

{ "mappings": { "properties": { "title": { "type": "text" }, "created_at": { "type": "date" }, "comments": { "properties": { "user": { "type": "keyword" }, "message": { "type": "text" }, "posted_at": { "type": "date" } } } } } }

Example mapping that works:

{ "mappings": { "properties": { "title": { "type": "text" }, "created_at": { "type": "date" }, "comments": { "type": "nested", "properties": { "user": { "type": "keyword" }, "message": { "type": "text" }, "posted_at": { "type": "date" } } } } } }

Difference: The working mapping includes "type": "nested" for the "comments" property.

The first mapping is valid and accepted by Elasticsearch, but the get_mappings tool fails to process it. This behavior is unexpected and may indicate a bug or an undocumented constraint in the tool’s handling of mappings.

Expected Behavior:
The tool should correctly decode and return mappings even when the "type": "nested" is omitted, as long as the mapping is valid per Elasticsearch standards.

Environment:
Elasticsearch version: 8.17.6
mcp-server-elasticsearch version: latest
Tool: get_mappings

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions