Skip to content

feat(engine): support getDayOfWeekEnum().getDisplayName() in Painless - #92

Merged
xerj-org merged 1 commit into
xerj-org:mainfrom
Vinz2168:feat/painless-day-of-week-display-name
Aug 1, 2026
Merged

feat(engine): support getDayOfWeekEnum().getDisplayName() in Painless#92
xerj-org merged 1 commit into
xerj-org:mainfrom
Vinz2168:feat/painless-day-of-week-display-name

Conversation

@Vinz2168

@Vinz2168 Vinz2168 commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

OpenSearch Dashboards' UBI sample index pattern defines a scripted field (day_of_week) using:

doc['timestamp'].value.getDayOfWeekEnum().getDisplayName(TextStyle.FULL, Locale.ROOT)

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 from fields), 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. exists queries on day_of_week initially looked like a data gap, but that was the wrong test — day_of_week is an OSD index-pattern scripted field (computed by Painless at query time), not a stored field, so exists was never going to find it either way. Fetching the index-pattern saved object directly surfaced the actual script in its fieldFormatMap/fields JSON. Reproduced directly against xerj with a script_fields request using that exact script: the field was silently absent from the response.

Fix

  • date_component: added a getDayOfWeekEnum case returning a title-cased day name ("Monday".."Sunday") instead of the existing numeric weekday.
  • eval_member_value: added getDayOfWeekEnum to the date-accessor dispatch, and a getDisplayName passthrough on strings (the TextStyle/Locale arguments are accepted syntactically but not interpreted — xerj already assumes a single locale elsewhere).

Test plan

🤖 Generated with Claude Code

https://claude.ai/code/session_014PRCbyt7Y2HDyhG1tbQTeL

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
@xerj-org
xerj-org merged commit 280545c into xerj-org:main Aug 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants