API ReferencePlatform

Search

Running a search view from code: full-text queries, filters, sorting, highlighting and facets.

Prefix /cdna-api/search ReferenceView model GuideSearch views

About search

A search view is a saved search over one of the Elasticsearch indexes: the master index, which holds pages, posts, books and the other content, or the facets index, which holds products with their facets. The view decides what can be searched, filtered, sorted and highlighted, and which of those a request may change; a request can change only what the view allows.

A site’s own search page renders a view with no API call. This route is for an integration or a headless front end, which calls it from its server: members are refused.

Indexes Master or facets

Facets come back only from a view on the facets index; on the master index facets is empty.

Facets
Parameters As the view allows

A parameter the view does not let a request change is dropped, not refused.

Search views
Access Admin users

Members are refused: a 404 by default, a 403 where the site’s access-denied setting says so. Call it from a server with an admin user’s OAuth token or API key.

Authentication and authorisation

Run a search view#

GET /cdna-api/search/{slug}

Runs the search view with this slug. With no parameters it returns the view’s first page in its own order.

Access
Admin users and integrations, with an OAuth access token or an API key.
Returns
data.response: totalCount, resultItems and facets. An unknown slug is a 404; when Elasticsearch cannot answer, an error with no data, never an empty list.

Parameters

slugpathrequired
string
The search view’s slug; it may contain slashes.
qquery
string
The words to search for.
pagequery
integer
The page, from 1.
limitquery
integer
Results per page, when the view lets the page size change; otherwise the view’s own page size applies.
orderByquery
string
field:asc or field:desc, comma-separated, from the view’s sort fields; _score sorts by relevance.
highlightFieldsquery
string
Fields to highlight, comma-separated.
(a filter field)query
string
Any other parameter filters on that field, such as fields.brand=nike, when the view lists it as a filter field. fields_brand works too.
queryType, fuzzy, minimumShouldMatch, tieBreaker, searchFieldsquery
string
The query’s tuning, each only when the view lets a request change it.

Example

Run a search view
GET /cdna-api/search/hub-docs-search?q=checkout HTTP/1.1
Host: hub.coredna.com
Authorization: Bearer YOUR_ACCESS_TOKEN
Accept: application/json
Response 200 OK
{
  "result": "success",
  "data": {
    "response": {
      "totalCount": 43,
      "resultItems": [
        {
          "_id": "books.entities.page.1714",
          "_score": 107.63309,
          "highlight": {
            "fields.testing body": [
              "The <em>checkout</em> record\nA <em>checkout</em> is created from the cart when the shopper starts paying, and replaced",
              "What \"ready for payment\" requires\nThe purchase call refuses a <em>checkout</em> that is not ready with \"<em>Checkout</em>"
            ]
          },
          "entityClass": "Books\\Entities\\Page",
          "id": 1714,
          "name": "Checkout",
          "fullPath": "/books/commerce/checkouts/checkout",
          "published": "2026-10-05T02:34:36+00:00"
        }
      ],
      "facets": {}
    }
  }
}
Real response from this documentation site, shortened