Skip to main content

Overview

You do two things, in order:
  1. Create a datasource --- declare object types (e.g. wiki_page, account) plus their property definitions (custom attributes such as department, priority), and optionally a tree of sub-datasources (used as the first/second-level filters in the search UI). Everything goes in a single POST /datasources call.
  2. Index documents --- send the standard built-in fields plus a custom_properties array whose name values match the property definitions, and (optionally) reference a sub-datasource by its key.
Every document carries a set of standard (built-in) fields that amberSearch already knows how to index, display, and filter. On top of those you can define custom attributes (property definitions) for metadata specific to your datasource.
Define properties and subs before you index documents that reference them. Adding or changing definitions later can delay or skew search behavior until affected documents are re-indexed (for example by re-sending them with POST .../documents).

Naming rules (slugs)

Several identifiers in the Indexing API must be slugs in word_word form:
  • Datasource name --- e.g. internal_wiki
  • Sub key --- e.g. engineering, runbooks
The slug regex is ^[a-z][a-z0-9]*(_[a-z][a-z0-9]*)*$:
  • lowercase letters and digits only,
  • words separated by single underscores (no hyphens, no spaces, no leading digit).
For subs, the key is auto-generated from name if you omit it (e.g. "HR Documents"hr_documents). The datasource name must always be supplied explicitly.

Standard document fields

These fields are available on every document without any property definition. They use the same naming conventions as all amberSearch datasources: For indexing examples, updates, deletes, and error handling see Index documents.

File types

file_type is required on every document and tells amberSearch how to render and treat the content. It must be one of: message, merge_request, issue, wiki, markdown, blog, content, timeline, email, file, directory, email_parent, issue_parent, wiki_parent, page, merge_request_parent, webpage, asset. Pick the value that best matches the source object (e.g. wiki for a wiki page, file for an arbitrary uploaded file, webpage for a scraped page, email for a mail message). The list is also exposed at runtime:
GET /file-types always returns 200 OK.

Sub-datasource hierarchy

amberSearch uses a three-level filter hierarchy for every datasource. These levels let users progressively narrow results: Subs are declared on the datasource (during creation, or later via the sub endpoints). On documents you reference subs by their key (the slug); amberSearch derives the human-readable label from the sub’s name and the compound storage values automatically.
If a data_source_sub_sub key is unique across the datasource, you can send it on a document without data_source_sub --- amberSearch will infer the parent. If the same child key appears under multiple parents the request fails with AMBIGUOUS_DATA_SOURCE_SUB_SUB; set data_source_sub explicitly in that case.

Custom attributes (property definitions)

For metadata that goes beyond the built-in fields, you declare property definitions inside an object definition on the datasource and send matching custom_properties on each document. Each property definition requires:
  • name --- the attribute key you reference later in custom_properties when indexing documents.
  • display_label --- the attribute display name shown in the search UI.
You also choose whether values should be searchable (is_searchable): when true, the property values are included in the full-text index so users can find documents by typing those values in a free-text query --- not only via structured filters.

Create the datasource (with subs and property schemas)

POST /api/indexing/datasources --- include subs for the sub-datasource tree and object_definitions (with nested property_definitions) so amberSearch knows which metadata fields exist for each object type.
Response codes In the search UI filters this renders as:

Datasource fields

Sub definition fields

Subs are limited to two levels: a top-level sub and one level of children. A child sub cannot have its own children.

Property definition fields

When to set is_searchable: true --- Use it for values users might type in a search box, such as ticket IDs, project codes, or category names. Leave it false for purely structural metadata (e.g. internal database IDs or numeric scores) that should only be available as structured filters.

Property types

Once your property definitions are in place, attach values on each document using custom_properties when indexing.

Manage subs after creation

POST /api/indexing/datasources/{name}/subs adds a single sub to an existing datasource. Add a top-level sub (auto-slug from name):
Add a child sub by setting parent_key to an existing top-level sub key:
Response codes for POST /datasources/{name}/subs Remove a sub by its key. Children of a deleted sub are removed as well (cascade).
Response codes for DELETE /datasources/{name}/subs/{sub_key}
Deleting a sub does not delete documents that reference it; those documents will remain in the index but lose the sub-level filter binding until you re-index them with a valid data_source_sub / data_source_sub_sub.

List, get, update, or delete a datasource

List
Get one (returns the datasource and its full sub tree)
Update --- PUT /api/indexing/datasources/{name}. Only display_name, icon_base64, and object_definitions can be changed here. Subs must be added or removed via the sub endpoints.
Delete --- removes the datasource together with its subs, users, groups, memberships, and indexed documents.
Cascade-deletes the datasource and all related data (subs, users, groups, memberships, and indexed Solr documents). Cannot be undone.

Response codes

Next step

Index documents

Push and update documents and permissions.