Skip to content

[Spike] ES Search: backend API audit #35369

Description

@hmoreras

Goal

Audit the existing backend endpoints consumed by ES-Search and determine whether the Angular portlet can consume them as-is, or if API changes are needed (new endpoints, @Schema fixes, error-shape normalization, Swagger coverage, versioning).

Scope of audit

Endpoints:

  • GET/POST /api/es/search (ESContentResourcePortlet#search, #searchPost)
  • GET/POST /api/es/raw (ESContentResourcePortlet#searchRaw)
  • POST /api/portlet/es-search/render (legacy JSP render — confirm NOT consumed by Angular)

For each endpoint, document:

Aspect Finding
Current request shape body, query params
Current response shape JSON structure, key fields
@Schema annotation accurate? missing?
Error shape HTTP status + body on invalid ES DSL, auth failure, license denial
Versioning is there a /api/v1/... equivalent? should we migrate?
Swagger coverage present in OpenAPI? Correct?
Authorization @RequiresAnyRole / license gate implementation

Known gap (pre-validated)

A live fetch of https://demo.dotcms.com/api/openapi.json on 2026-04-17 confirmed that /api/es/search and /api/es/raw are absent from the OpenAPI spec. Only the tag Elasticsearch Content Search exists with zero paths attached. No ESSearchResults, ESSearchResponse, or related schemas are published.

Fixing this is a mandatory deliverable of this spike, not a speculative finding. The spike therefore has two outcomes:

  1. Document current behavior (reverse-engineered from ESContentResourcePortlet.java + runtime calls)
  2. Produce a PR (or child issue under Dojo to Angular: Backend API Updates #34292) that adds the missing @Schema, @Operation, and @ApiResponse annotations so these endpoints appear in the OpenAPI spec

Deliverable

A section in this issue's body (edited directly) with:

  1. Per-endpoint table as above
  2. Before / after comparison: OpenAPI spec diff after the annotation PR lands
  3. Child issues filed under Dojo to Angular: Backend API Updates #34292 for any non-annotation BE work (e.g. error-shape normalization if it is messy)

Acceptance Criteria

  • All 4 endpoints audited against both source code and live OpenAPI spec
  • OpenAPI spec re-fetched from http://localhost:8080/api/openapi.json after changes; /api/es/search and /api/es/raw appear with complete request/response schemas
  • ESSearchResults and SearchResponse-equivalent schema components are defined in components/schemas
  • Error shape documented (what the Angular FE must handle: 4xx on bad JSON, 401/403 on auth, 402/451 on license)
  • Any non-annotation changes filed as child issues under Dojo to Angular: Backend API Updates #34292 and linked here
  • No BE behavior changed — annotations only (behavior changes filed separately)

Out of scope

  • Do NOT implement any BE behavior fix in this spike (file child issues instead)
  • Do NOT specify Angular service shape (handled in the FE implementation spec sub-task)

Parent

#34733

Metadata

Metadata

Assignees

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions