Elasticsearch Content Search

Search content using a search query (POST)

Changed on

Executes a JSON search query against dotCMS content in a portlet context. The request body accepts an Elasticsearch/OpenSearch JSON query. The query is routed through the phase-aware search API, so it targets whichever engine the active OpenSearch migration phase selects (Elasticsearch in phases 0-1, OpenSearch in phases 2-3). Results include the matching contentlets plus the search response metadata under 'esresponse', which retains the legacy Elasticsearch-wire shape (took, hits.total, hits.hits[]._id/._index/._score/._source, aggregations) for backward compatibility, regardless of the engine that served the query.

post/api/es/search

Request

Query parameters

depthstring

Depth of related content to include: 0=identifiers only, 1=related contentlets, 2=related contentlets with their related identifiers, 3=related contentlets with their related contentlets. Omit to exclude relationships.

liveboolean

If true, search only live content; if false, search working content

useridstring

Admin-only: run the query under the permission context of this user ID or email address

allCategoriesInfoboolean

If true, return full category details (key, name, description); if false, return only category names

Request body

string required

Response

Search results returned successfully

object required

Search results containing the matching contentlets and the Elasticsearch-wire response metadata under 'esresponse'

Changes

    • info

      api operation id searchPost removed and replaced with searchContentByESPost

    • info

      api tag Elasticsearch Content Search added

    • info

      added the new optional query request parameter userid

    • info

      added the non-success response with the status

    • info

      added the non-success response with the status

    • info

      added the success response with the status