feat(elasticsearch): add hit document view and field type detection

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-09-04 01:01:32 +08:00
1 parent 37dc74d9de
commit 0bdf232487
7 files changed
+205 -13

No files matched your search

@@ -398,6 +398,33 @@ afterEach(() => {
});
describe("DocumentBrowser Elasticsearch field search", () => {
it("passes Elasticsearch mapping types through to the table grid", async () => {
app?.unmount();
backend.getColumns.mockResolvedValue([
{ name: "profile", data_type: "object" },
{ name: "profile.name", data_type: "keyword" },
{ name: "title", data_type: "text" },
]);
backend.documentFindDocuments.mockResolvedValue({
documents: [{ _id: "document-1", title: "Example", profile: { name: "Ada" } }],
raw_documents: [],
total: 1,
total_is_exact: true,
});
app = createApp(DocumentBrowser, {
connectionId: "connection-1",
database: "",
collection: "orders",
databaseType: "elasticsearch",
});
app.mount(root!);
await flushUi();
const types = JSON.parse(root!.querySelector<HTMLElement>("[data-testid='data-grid']")!.dataset.resultColumnTypes ?? "[]");
expect(types).toEqual(["keyword", "text", "object"]);
});
it("migrates hidden columns and passes a stable index layout scope without changing the query result", async () => {
app?.unmount();
const legacyScopeKey = documentGridColumnVisibilityScopeKey({