elastic/elasticsearch
View on GitHubSource filtering fails for nested fields under backslash-named parent field
Open
#136302 opened on Oct 9, 2025
:Search Foundations/Search>bugTeam:Search Foundationshelp wanted
Description
Elasticsearch Version
9.1.5
Installed Plugins
No response
Java Version
bundled
OS Version
Darwin Kernel Version 24.6.0: Mon Aug 11 21:16:34 PDT 2025; root:xnu-11417.140.69.701.11~1/RELEASE_ARM64_T6020 arm64
Problem Description
Source filtering using _source parameter fails to return nested fields when the parent field name is a backslash (\) character. This worked correctly in version 8.5.3 but stopped working starting from 8.6.0.
Steps to Reproduce
- Create an index with a backslash-named field containing nested properties:
PUT test
{
"mappings": {
"properties": {
"\\": {
"properties": {
"nested_value": {
"type": "text"
}
}
}
}
}
}
- Index a document:
POST test/_doc?refresh
{
"\\": {
"nested_value": "value_C"
}
}
- Query with source filtering for the parent field (works correctly):
GET test/_search
{
"_source": ["\\"]
}
Result: Returns the full \ object with its nested_value ✅
- Query with source filtering for the nested field (fails):
GET test/_search
{
"_source": ["\\.nested_value"]
}
Result: Returns empty source ❌
Expected behavior: The query in step 4 should return:
{
"hits": {
"hits": [
{
"_source": {
"\\": {
"nested_value": "value_C"
}
}
}
]
}
}
Actual behavior:
The query returns documents but with empty _source:
{
"hits": {
"hits": [
{
"_source": {}
}
]
}
}
- This is a regression: the same query worked correctly in version 8.5.3. It still does not work in 9.1.5
- The issue specifically affects field paths where the parent field name is a backslash character
- Fetching the parent field
\directly works, but accessing nested properties via dot notation fails
Logs (if relevant)
No response