Skip to content

fix(plugin-elasticsearch): show nested fields instead of null - #2905

Merged
datlechin merged 4 commits into
TableProApp:mainfrom
digows:fix/elasticsearch-nested-fields
Sep 16, 2026
Merged

datlechin merged 4 commits into
TableProApp:mainfrom
digows:fix/elasticsearch-nested-fields

Conversation

@digows

@digows digows commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Elasticsearch nested fields such as identifiers on kortex-clinical-persons-v1 showed as identifiers.issuer (and siblings) with every cell null. The mapping walker treated nested as object and exploded leaves; _source keeps an array of objects, so dotted lookup missed. JSON mode serializes grid cells, so it repeated the same nulls. Filters on those leaves were sent as flat term queries and missed documents.

Fix

  • Mapping still emits dotted leaves (identifiers.type). A nested parent is also a JSON column for the array.
  • Hit mapping walks arrays the way Typesense already does, so a leaf is a JSON array of values (["8930"], or both CPF and PATIENT_ID), never the first object only, never null when _source has the array.
  • Filters and sorts on a nested leaf wrap in a nested query. Two filter rows with the same element scope share one nested query (same nested object). Object dotted columns are unchanged.

JSON mode is still the grid row. With the parent column present it contains the identifiers array; dotted leaves are arrays of scalars, not null.

Tests

ElasticsearchMappingFlattenerTests and ElasticsearchQueryDSLTests cover the spec fixture: one identifier, two identifiers, missing nested field, object-array leaves, nested query wrap, same-element grouping, and nested sort.

Verified locally against kortex-clinical-persons-v1: nested identifiers render in the grid and JSON, including people with both CPF and PATIENT_ID.

Docs

docs/databases/elasticsearch.mdx browsing section now describes the nested parent column, leaf arrays, and nested filters.

@datlechin
datlechin merged commit 5489698 into TableProApp:main Sep 16, 2026
3 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