-
Notifications
You must be signed in to change notification settings - Fork 103
Description
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