-
Notifications
You must be signed in to change notification settings - Fork 25.4k
Fix decoding of non-ascii field names in ignored source #132018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
jordan-powers
merged 3 commits into
elastic:main
from
jordan-powers:fix-utf-encoding-ignored-source-2
Jul 28, 2025
Merged
Fix decoding of non-ascii field names in ignored source #132018
jordan-powers
merged 3 commits into
elastic:main
from
jordan-powers:fix-utf-encoding-ignored-source-2
Jul 28, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
Hi @jordan-powers, I've created a changelog YAML for you. |
martijnvg
approved these changes
Jul 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
This was referenced Jul 28, 2025
jordan-powers
added a commit
to jordan-powers/elasticsearch
that referenced
this pull request
Jul 28, 2025
When encoding an ignored source entry, we write the string length of the field name, not the encoded byte count; however, the decode logic treats this encoded value as the byte length. This patch updates the decode logic to instead properly treat the value as the string length.
jordan-powers
added a commit
to jordan-powers/elasticsearch
that referenced
this pull request
Jul 28, 2025
When encoding an ignored source entry, we write the string length of the field name, not the encoded byte count; however, the decode logic treats this encoded value as the byte length. This patch updates the decode logic to instead properly treat the value as the string length.
jordan-powers
added a commit
to jordan-powers/elasticsearch
that referenced
this pull request
Jul 28, 2025
When encoding an ignored source entry, we write the string length of the field name, not the encoded byte count; however, the decode logic treats this encoded value as the byte length. This patch updates the decode logic to instead properly treat the value as the string length.
elasticsearchmachine
pushed a commit
that referenced
this pull request
Jul 28, 2025
…32030) When encoding an ignored source entry, we write the string length of the field name, not the encoded byte count; however, the decode logic treats this encoded value as the byte length. This patch updates the decode logic to instead properly treat the value as the string length.
elasticsearchmachine
pushed a commit
that referenced
this pull request
Jul 28, 2025
…32029) When encoding an ignored source entry, we write the string length of the field name, not the encoded byte count; however, the decode logic treats this encoded value as the byte length. This patch updates the decode logic to instead properly treat the value as the string length.
elasticsearchmachine
pushed a commit
that referenced
this pull request
Jul 28, 2025
…32031) When encoding an ignored source entry, we write the string length of the field name, not the encoded byte count; however, the decode logic treats this encoded value as the byte length. This patch updates the decode logic to instead properly treat the value as the string length.
💚 All backports created successfully
Questions ?Please refer to the Backport tool documentation |
jordan-powers
added a commit
to jordan-powers/elasticsearch
that referenced
this pull request
Jul 28, 2025
When encoding an ignored source entry, we write the string length of the field name, not the encoded byte count; however, the decode logic treats this encoded value as the byte length. This patch updates the decode logic to instead properly treat the value as the string length. (cherry picked from commit 178c0c9)
jordan-powers
added a commit
that referenced
this pull request
Jul 28, 2025
In #132018, we found an issue with non-ascii strings in ignored source. This issue was not exposed by the data generation tests because these tests use ascii-only strings. This patch updates the tests to instead use full unicode strings by default.
elasticsearchmachine
pushed a commit
that referenced
this pull request
Jul 28, 2025
…32034) When encoding an ignored source entry, we write the string length of the field name, not the encoded byte count; however, the decode logic treats this encoded value as the byte length. This patch updates the decode logic to instead properly treat the value as the string length. (cherry picked from commit 178c0c9)
szybia
added a commit
to szybia/elasticsearch
that referenced
this pull request
Jul 29, 2025
…-tracking * upstream/main: (26 commits) Add release notes for v9.1.0 release (elastic#131953) Unmute multi_node generative tests (elastic#132021) Avoid re-enqueueing merge tasks (elastic#132020) Fix file entitlements for shared data dir (elastic#131748) ES|QL brute force l2_norm vector function (elastic#132025) Make ES|QL SAMPLE not a pipeline breaker (elastic#132014) Speed up tail computation in MemorySegmentES91OSQVectorsScorer (elastic#132001) Remove deprecated usages in `TransportPutFollowAction` (elastic#132038) Simulate impact of shard movement using shard-level write load (elastic#131406) Remove RemoteClusterService.getConnections() method (elastic#131948) Fix off by one in ValuesBytesRefAggregator (elastic#132032) Use unicode strings in data generation by default (elastic#132028) Adding index.refresh_interval as a data stream setting (elastic#131482) [ES|QL] Add more Min/MaxOverTime CSV tests (elastic#131070) Restrict remote ENRICH after FORK (elastic#131945) Fix decoding of non-ascii field names in ignored source (elastic#132018) [docs] Use centrally maintained version variables (elastic#131939) Configurable Inference timeout during Query time (elastic#131551) ESQL: Allow pruning columns added by InlineJoin (elastic#131204) ESQL: Fail `profile` on text response formats (elastic#128627) ...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
auto-backport
Automatically create backport pull requests when merged
>bug
:StorageEngine/Mapping
The storage related side of mappings
Team:StorageEngine
v8.18.5
v8.19.1
v9.0.5
v9.1.1
v9.2.0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When encoding an ignored source entry, we use
String.length()
to get the length of the encoded field name. This will only work when the UTF-8 encoding has only ascii characters, with 1 byte per character.The solution is to use the actual length of the encoded field name byte[] array.
I added a test that encodes a field in _ignored_source with a random unicode key. Without this fix, it fails with this stack trace:
This is an alternative solution to the same issue as #131950. I think this solution is better because it can read old data written prior to this change (since this solution only changes the decoding logic, and the encoding logic stays the same).