Skip to content

Connect SPSync to OpenSearch

SPSync writes one OpenSearch index per table: a list’s main table, each multi-value child table and the shared users table. Rows are indexed by key, and a row deleted in SharePoint is removed from the index rather than flagged. This guide covers a cluster you run yourself and the managed Amazon OpenSearch Service.

  • An OpenSearch cluster you can reach over HTTP(S), and its URL, for example https://my-cluster.example.com:9200.
  • An administrator account on the cluster’s security plugin (or the domain’s master user on Amazon OpenSearch Service) to create a role and a user.
  • Nothing to install on the machine that runs SPSync. SPSync keeps a small local state file (a DuckDB file) that records what it last sent, so it sends only the rows that changed. Keep that file on a disk that survives restarts.

Create the database and a least-privilege user

Section titled “Create the database and a least-privilege user”

With the security plugin on, give SPSync a role limited to the indexes it creates. This is from the OpenSearch security documentation and has not been run here against a test cluster. In Dashboards, Security, Roles, create a role, or call the API:

PUT _plugins/_security/api/roles/spsync_loader
{
"cluster_permissions": ["cluster_composite_ops"],
"index_permissions": [
{
"index_patterns": ["dev_*", "sp_users"],
"allowed_actions": ["create_index", "crud", "indices:admin/mapping/put", "indices_monitor"]
}
]
}

dev_* is the --prefix you give SPSync; use your own. crud covers indexing and deleting documents. indices:admin/mapping/put lets SPSync add a field when a SharePoint column is added. When a column changes type, OpenSearch cannot change the field in place, so SPSync starts a new index with _v2 on the end, which the same pattern covers.

Then create an internal user and map the role to it:

PUT _plugins/_security/api/internalusers/spsync_loader
{ "password": "use-a-long-random-password" }
PUT _plugins/_security/api/rolesmapping/spsync_loader
{ "users": ["spsync_loader"] }

On Amazon OpenSearch Service with fine-grained access control, do this in Dashboards as the master user. Mapping the role to an AWS IAM role instead (under Backend roles) is how a SigV4 caller is authorised; see below.

spsync search-grants prints the role and mapping for your prefix, and runs nothing:

Terminal window
spsync search-grants --store opensearch --prefix dev_
spsync search-grants --store opensearch --prefix dev_ --principal iam \
--backend-role arn:aws:iam::111122223333:role/spsync \
--aws-account 111122223333 --domain my-domain --aws-region eu-west-1

The second form maps your AWS IAM role as a backend role and prints a matching IAM policy limited to your prefix, for SigV4. Not run against a live domain.

OpenSearch listens on TCP 9200 unless you changed it, and managed domains use 443. The connection starts from the machine that runs SPSync.

  • Self-hosted: allow the SPSync address in the host firewall and any load balancer.
  • Amazon OpenSearch Service, public access: in the domain’s access policy, allow the address, and keep fine-grained access control on.
  • Amazon OpenSearch Service, VPC access: a domain in a VPC has no public address. Run SPSync inside the VPC, or connect to it from where SPSync runs with a VPN or Direct Connect, and allow the SPSync address on the domain’s security group for port 443.
  • Aiven and other managed services: add the address to the service’s IP allow-list.

Use an https:// URL. SPSync verifies the server’s certificate unless you turn that off. Amazon OpenSearch Service presents a certificate from a public authority, so it needs nothing more. A self-hosted cluster that uses the demo certificates or a private CA needs the CA certificate as PEM text, which replaces the machine’s trust store for this destination only.

On the Destination screen, paste the PEM into CA certificate bundle. A client certificate for mutual TLS goes in Client certificate and Client private key (an unencrypted PEM key). SPSync keeps these as stored secrets: in the operating system keychain on the desktop app, and as a Key Vault reference in the Azure edition, and it never shows them again after you save. If you reach the cluster by an address its certificate does not name, put the name the certificate does carry in Certificate name to check.

Clearing Verify the server certificate turns checking off. The connection stays encrypted but SPSync no longer checks who it is talking to. Use it only while you fix the certificate. SPSync logs a destination_tls_verification_disabled warning on every run, Test connection reports “connected (warning: …)” and spsync doctor prints a WARNING.

This setting is a preview. SPSync’s automated tests run the real OpenSearch client against a local TLS server, serving a certificate from a throw-away CA, and check that the connection succeeds with the CA and fails without it. It has not been run against Amazon OpenSearch Service or a production cluster. spsync doctor prints a destination-tls line with the trust mode and, where a plain TLS handshake can read it, the server certificate’s subject and expiry date. SPSync does not rewrite the URL, so an http:// address sends the credential in clear text.

Three ways exist in the engine. Use exactly one.

  • API key: sent as an Authorization: ApiKey header.
  • Basic authentication: the user name and password from the previous section.
  • AWS SigV4 request signing: the usual choice for a managed domain. Set the AWS region (and the signing name, es by default or aoss for OpenSearch Serverless). It is available from the desktop app and server Destination screen, the command line and an AI assistant.

With SigV4, SPSync signs each request with the AWS credential on the machine: environment variables, a shared credentials file or an instance role. Give SPSync an explicit access key pair (and a session token for temporary keys) only if the machine has no AWS credential of its own, or you must override it. Entra ID and other single sign-on are not supported.

  • Desktop app: open the Destination screen, choose OpenSearch, enter the OpenSearch URL and one sign-in: an API key, a username and password, or an AWS region for SigV4 (with the access key id and secret access key only if the machine has no AWS credential of its own), then choose Test connection. SPSync manages the local state file itself.

  • CLI: the config names environment variables, never the credential itself. A private CA goes in the destination: block as tls_ca_env (an environment variable, or a file: or env: reference), with tls_client_cert_env, tls_client_key_env and tls_server_name as options and tls_verify: false as the explicit way to turn checking off. SPSYNC_OS_STATE_PATH holds the path of the local state file, not a network address.

    Terminal window
    export SPSYNC_OS_STATE_PATH=/var/lib/spsync/opensearch-state.duckdb
    export SPSYNC_OS_PASSWORD='use-a-long-random-password'
    spsync export-config --output replication.yaml \
    --site-url https://contoso.sharepoint.com/sites/x --list Projects \
    --pipeline-name spsync_dev --prefix dev \
    --destination-kind opensearch --connection-string-env SPSYNC_OS_STATE_PATH \
    --dataset-name main \
    --opensearch-url https://my-cluster.example.com:9200 \
    --opensearch-username spsync_loader --opensearch-password-env SPSYNC_OS_PASSWORD \
    --client-id <entra-app-client-id>

    For an API key use --opensearch-api-key-env SPSYNC_OS_API_KEY instead of the user flags. For SigV4 use --opensearch-aws-region us-east-1 (and --opensearch-aws-service aoss for Serverless) and no other credential flag.

  • AI assistant: with the admin MCP server connected, ask for the destination requirements, then let the assistant create the destination with the URL. For SigV4 it also sets the non-secret region and signing name. You enter the API key, password or AWS keys on the secure entry page, never in the chat; leave the keys out to sign with the machine’s own AWS credential.

Both ask the cluster to respond to a ping. A pass means the URL is reachable, the certificate is trusted and the cluster answered. It does not prove the credential can create or write to an index; the first sync is the real test of the role. spsync doctor reports the probe as destination-connectivity.

spsync doctor also asks the security plugin who it connected as (_plugins/_security/authinfo) and appends the user name and backend roles to that line, for example as arn:aws:iam::123456789012:role/spsync (backend roles: ...). No credential is printed. A cluster without the security plugin does not answer, and then the identity is simply left out and the check still passes.

Each run also writes one destination.connected_as line to the run log with the same identity, so an operator can see which user or role the load used. If the lookup fails the line is left out and the run is not affected. SPSync cannot read an expiry date for an OpenSearch credential (the security plugin’s authinfo answer carries none), so it shows no expiry warning for OpenSearch. If your API key or temporary AWS keys expire, rotate them on your own schedule.

What you see What it means and the fix
Connection refused or a timeout A firewall, security group or access policy is blocking the port, or the domain is in a VPC SPSync cannot reach.
TLS certificate problem; server certificate verified against the system trust store The certificate is a demo or private-CA certificate. Paste the CA into CA certificate bundle, or use one from a public authority.
401 Unauthorized The user name, password or API key is wrong.
403 ... no permissions for [indices:...] The role does not cover the index or the action. Widen index_patterns to match your prefix and check the role mapping.
403 ... User: arn:aws:... is not authorized (SigV4) The AWS identity SPSync signed with is not allowed by the domain’s access policy, or is not mapped to a role in fine-grained access control.
Authentication failed: the API key or the password is incorrect The cluster answered with HTTP 401: the user name or password is wrong or has been rotated. Fix the credential and run spsync doctor again.
could not ping OpenSearch cluster The cluster answered but is not healthy, or a proxy is in the way. Check from the same machine with curl.