Indexing API (BETA) --- Overview · Datasource & properties · Index documents · Permissions
Overview
Setpermissions on each document when you index it. Search only returns documents the signed-in user is allowed to see.
User context uses login email. The person searching is always an amberSearch user identified by the email on their account (the email they have when they log in to amber). Every permission that targets a specific person must use that same email:
POST /users → user.email, allowed_users → { "email": "..." }, POST /memberships → member_email, and POST .../documents/check-access → user_email. Email lookups are case-insensitive (stored lowercased).Documents indexed without a
permissions block are stored with the anonymous token. That token reaches only users who are registered on this datasource (created with POST /users) --- not everyone in your amberSearch org. A signed-in user with no user record on the datasource sees none of its documents, including anonymous ones. To restrict further within the datasource, send allowed_users and/or allowed_groups on the document.1. Open to everyone registered on the datasource
“Anonymous” here means no per-user or per-group restriction inside the datasource --- it does not mean public to your whole org. The document is still only reachable by people registered on the datasource via
POST /users.2. Specific users only
Permissions are always resolved by email --- the same address on the user’s amberSearch account. a) Register each person once per datasource.email is required and must equal the address on their amberSearch user profile (same as when they log in). The optional name is for display only and does not replace email for access checks.
POST /users
Update a user’s display name later with
PUT /users/{datasource}/{email}:
PUT /users/{datasource}/{email}
b) Reference them on the document with
allowed_users and the same emails:
3. Groups
Order of operations:- Users ---
POST /usersfor each person (same as above). - Group ---
POST /groupswith aname. Group name rules: must be non-empty, must not contain whitespace, and must not start withamber(case-insensitive). - Membership ---
POST /membershipswithgroup_nameand eithermember_email(the member’s amber login email) ormember_group_name(to nest another group). Exactly one of the two must be set. - Document ---
allowed_groups: ["engineering"].
POST /groups
Rename it later with
PUT /groups/{datasource}/{group_name}:
PUT /groups/{datasource}/{group_name}
Add a user as a member (
member_email = amber login email):
member_group_name):
POST /memberships
Document snippet:
Remove a membership
DELETE /memberships/{datasource}/{group_name}/{member_type}/{member_id} --- member_type is user or group. For user, member_id is the email; for group, it is the nested group’s name.
DELETE /memberships/{datasource}/{group_name}/{member_type}/{member_id}
Group membership is transitive. When
engineering is a member of all-staff, anyone who is a member of engineering (directly or via further nesting) is also treated as a member of all-staff for access checks.Verify access
user_email must be the same amber login email you use in /users and permissions. The check resolves the user’s transitive group memberships and compares them to the document’s stored access tokens.
POST /documents/check-access
Remember that newly indexed documents may take up to 2 hours to be committed and become discoverable;
check-access queries the search index directly so it will not find a document that is still being processed.
Behaviour notes
- Permission updates can take a short time to apply everywhere in search.
- Tighten rules after testing: start with
allow_anonymous_access: true(or nopermissions) if you need to confirm indexing before locking down. Even then, register your own login email on the datasource withPOST /usersfirst --- without a user record you will not see the datasource’s documents, anonymous or otherwise. - Renaming a group after documents reference it will leave existing Solr documents pointing at the old name; re-index those documents to apply the new name.

