feat(engine): support getDayOfWeekEnum().getDisplayName() in Painless - #92
Merged
xerj-org merged 1 commit intoAug 1, 2026
Merged
Conversation
OpenSearch Dashboards' own UBI sample index pattern defines a scripted
field using:
doc['timestamp'].value.getDayOfWeekEnum().getDisplayName(TextStyle.FULL, Locale.ROOT)
xerj's Painless subset only implemented the numeric `getDayOfWeek()`
accessor, not the enum-returning `getDayOfWeekEnum()` or the
`getDisplayName(...)` method on it. Confirmed live via `script_fields`
against xerj: the script failed and was silently dropped from the
response (no error surfaced), which is why the UBI dashboard's
"Searches by Day of Week" panel rendered empty even with a populated
index.
Adds `getDayOfWeekEnum` as a date accessor returning a title-cased day
name string ("Monday".."Sunday"), and `getDisplayName` as a string
passthrough (the locale/style arguments are accepted but not
interpreted, matching the single locale xerj already assumes
elsewhere).
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014PRCbyt7Y2HDyhG1tbQTeL
5 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
OpenSearch Dashboards' UBI sample index pattern defines a scripted field (
day_of_week) using:xerj's Painless subset only implemented the numeric
getDayOfWeek()accessor.getDayOfWeekEnum()and.getDisplayName(...)were unsupported, so the script failed — and since scripted-field errors are dropped silently (no error surfaced to the client, the field is just omitted fromfields), the "Searches by Day of Week" dashboard panel rendered empty with no visible cause.How this was found
While live-verifying the UBI dashboards end-to-end (see #86–#89, #91), the "Searches by Day of Week" panel was empty.
existsqueries onday_of_weekinitially looked like a data gap, but that was the wrong test —day_of_weekis an OSD index-pattern scripted field (computed by Painless at query time), not a stored field, soexistswas never going to find it either way. Fetching the index-pattern saved object directly surfaced the actual script in itsfieldFormatMap/fieldsJSON. Reproduced directly against xerj with ascript_fieldsrequest using that exact script: the field was silently absent from the response.Fix
date_component: added agetDayOfWeekEnumcase returning a title-cased day name ("Monday".."Sunday") instead of the existing numeric weekday.eval_member_value: addedgetDayOfWeekEnumto the date-accessor dispatch, and agetDisplayNamepassthrough on strings (theTextStyle/Localearguments are accepted syntactically but not interpreted — xerj already assumes a single locale elsewhere).Test plan
cargo fmt --checkcargo clippy -p xerj-engine -p xerj-query -p xerj-api --all-targets -- -D warningscargo test -p xerj-engine -p xerj-query -p xerj-api --lib(xerj-api 94/94, xerj-query 131/131, xerj-engine 259/261 — the 2 failures are the pre-existing, unrelatedsnapshot_path_security_testsfailures also present onupstream/main)day_of_week_enum_display_name_returns_full_english_name,day_of_week_enum_display_name_covers_the_week(all 7 weekdays)day_of_weekfield uses now returns correct buckets (curlagainst_searchand_msearch), and the "Searches by Day of Week" dashboard panel — previously "No results found" — now renders a populated donut chart with all 7 weekdays after a dashboard refresh.🤖 Generated with Claude Code
https://claude.ai/code/session_014PRCbyt7Y2HDyhG1tbQTeL