Setting up OpenSearch for Mattermost

A planning and build guide for connecting self-hosted Mattermost to on-premises OpenSearch or Amazon OpenSearch Service, covering version requirements, dedicated hosts, indexing and tuning.

On this page

How Mattermost search moves to OpenSearch

When database search is no longer enough for your Mattermost users, the work is to choose a search backend and connect it from the System Console to a dedicated OpenSearch cluster that your organization controls. Mattermost does not run the search engine for you, so the cluster, its certificates, its storage and its patching stay with your platform team. OpenSearch is an open-source search and analytics engine released under the Apache License, Version 2.0 with no paid edition described in its FAQ, and it is forked from Elasticsearch 7.10. For Mattermost, that lineage matters less than the practical result: post search queries move off the primary database and onto an index that your team sizes and operates.

The integration changes what users and admins see. Users keep the same search box, but results come from the index rather than from PostgreSQL queries, so search load and indexing load now land on the OpenSearch nodes. Admins gain new operational duties: monitoring index health, deciding when to run bulk indexing of existing posts, and handling the index when a Mattermost upgrade or a schema change requires it. Before you plan anything, confirm against current Mattermost documentation that the OpenSearch 2.x requirement applies to Mattermost v12, since the topic brief ties this requirement to that release. Confirm also which OpenSearch versions Mattermost supports for your target server version, because the OpenSearch maintenance policy does not decide compatibility for you.

Treat the decision as a planning step with written criteria. Record your current Mattermost server version, your planned upgrade path under the monthly and Extended Support Release cadence, and the OpenSearch version you intend to deploy, then check that the three line up before procurement. Ask your Mattermost account team or consult the Mattermost server releases page to confirm release dates and support windows. Also confirm which identity and access controls you need on the search cluster, because OpenSearch provides TLS, role-based access control and audit logging through its Security plugin, and those settings must be designed before Mattermost connects.

What you need in place before connecting OpenSearch

Connecting Mattermost to OpenSearch goes wrong most often because a prerequisite was assumed rather than checked. The six items below cover the server version, database, plan level, search cluster, network and certificates, and release timing that the connection step depends on.

Mattermost version matching OpenSearch

Confirm your Mattermost server version meets the OpenSearch version requirement that applies from Mattermost v12 before you change any search settings. Check which OpenSearch line your version requires, then plan the search cluster around that line rather than the newest release. Also confirm whether your current server is on a monthly release or an Extended Support Release, because that determines how often you will revisit this check.

Version with OpenSearch 2.x rule
v12.0
Server releases page

PostgreSQL primary database

Mattermost keeps its system of record in PostgreSQL, and the search index is a copy of post data rather than a replacement for it. Confirm the primary database is healthy, backed up and reachable from every Mattermost application node before enabling search. A broken database connection will surface as search failures that look like index problems, so verify the database first.

Plan level that includes search

Check the pricing page for the plan that includes the search feature you intend to use, because plan entitlements change between releases. Confirm this with Mattermost sales in writing before you size hardware. High availability clustering is limited to the Enterprise and Enterprise Advanced plans, so a clustered deployment needs that plan regardless of search.

Mattermost pricing

Dedicated OpenSearch cluster or domain

Provision a dedicated OpenSearch cluster or an Amazon OpenSearch Service domain sized for the index you expect, not a shared cluster that also serves logs or other applications. Estimate index size from your current post volume and retention plan, then ask your platform team or AWS account team to confirm node count, storage and snapshot settings. Separating the search workload prevents indexing from slowing chat for everyone.

Creating a cluster

Network routes and firewall rules

Open the paths between every Mattermost application node and the search endpoint on the port your OpenSearch listener uses, and confirm the return traffic is allowed. Confirm DNS resolves the search hostname from each node, including any Mattermost nodes in a second site. Test connectivity from the Mattermost host itself, since a route that works from an admin workstation proves little about the server.

TLS certificates and a trusted CA

Issue a certificate for the OpenSearch endpoint and confirm that the CA chain is trusted by the Mattermost server, so the connection validates without disabling verification. Record who owns renewal and how the certificate is rotated, since an expired certificate will stop indexing without an obvious error. Use the security settings guidance in the OpenSearch security documentation to plan TLS for node and client traffic.

OpenSearch security docs

How Mattermost, PostgreSQL and OpenSearch fit together

The diagram starts with users and admins sending requests to Mattermost application nodes inside the client network, where TLS should terminate before traffic reaches the application. Mattermost is the only component that talks to OpenSearch, so search results reach users through Mattermost rather than through direct access to the search cluster. PostgreSQL remains the system of record for posts and users, while OpenSearch holds an index that Mattermost builds and queries. Check where each TLS boundary sits and which identity the OpenSearch security plugin uses to authenticate Mattermost.

Request and data paths between users, Mattermost, PostgreSQL and the OpenSearch cluster.

Connecting Mattermost to OpenSearch step by step

This sequence connects a self-hosted Mattermost deployment to a dedicated OpenSearch cluster using a restricted service identity and encrypted traffic. Each step closes with a check, so you confirm the cluster, the connection and search results before users depend on them. Confirm version-specific settings against your Mattermost and OpenSearch releases.

  1. Provision dedicated OpenSearch nodes and confirm health

    Your platform or infrastructure team installs OpenSearch on hosts that serve only search, using a method OpenSearch documents, such as tarball, RPM, Debian packages, Docker, Helm or the Kubernetes operator. Node count and storage depend on your post volume and retention, so confirm them with the Mattermost sizing guidance before you buy hardware. Write any Terraform against the provider versions you run and test it in a non-production account first. Done means the cluster health API reports green and every node has joined the cluster.

  2. Create a restricted service identity for Mattermost

    An administrator creates a dedicated internal user in the OpenSearch Security plugin and maps it to a role that grants only the index permissions Mattermost needs. Keep the role away from cluster-wide administration and from other applications' indices, and do not reuse an administrator account. Store the credential in your secrets manager, not in a shared document. Confirm the exact privileges against the Mattermost search documentation for your version. Done means the service user authenticates, can write and search the Mattermost index, and receives an access denied response on an unrelated index.

  3. Enable TLS and load the certificate authority

    Platform engineers turn on TLS for node-to-node and client traffic in OpenSearch, then copy the certificate authority file to each Mattermost application server and set its path in the configuration. Use certificates from your internal CA or another trusted authority, and confirm that the subject names match the hostnames Mattermost connects to. Keep certificate verification enabled, even when an error appears during setup. Done means a request from a Mattermost application node to the HTTPS endpoint returns the cluster response with a valid certificate chain.

  4. Set the endpoint and credentials in the System Console

    A Mattermost system administrator enters the HTTPS endpoint, the service user's credentials and the CA file path in the search settings of the System Console, then saves the change. Confirm the menu path and field names for your Mattermost version, because they change between releases. Run the connection test before you enable indexing. Done means the test reports success and the application logs show no authentication or certificate errors from the search client during the test.

  5. Index a test set of posts first

    Before a full run, the administrator creates a small test channel with a few posts that contain known phrases, then indexes only that channel or a limited date range using the bulk indexing option available in your version. Watch the job status and the application logs, and record how long the test takes so you can plan the full run with the vendor's guidance. Done means the index document count matches the number of test posts and the job completes without skipped records.

  6. Verify search results for a test user

    Sign in as a test user who is a member of the test channel and search for a unique phrase from one of the test posts. Then sign in as a second test user with no membership to that channel and run the same search. The first user should see the expected post and the second user should not, which confirms that Mattermost channel permissions still apply to search results. Repeat these checks after the full indexing run and after each upgrade. Done means both searches return the expected results and no restricted content appears.

How Mattermost data and access map to OpenSearch

This table compares what each side holds in an OpenSearch-backed Mattermost deployment: the system of record, the search index, the service account and the OpenSearch roles that limit it. Read it as a checklist of where access is decided, because Mattermost filters results before they reach users. The main takeaway is that OpenSearch roles limit the service account, while channel permissions are enforced by Mattermost at query time.

ComponentWhat it holds or doesWhat to verify
Mattermost posts and channel membershipPosts, channel and team membership, and user status live in PostgreSQL, which remains the system of record.Confirm that PostgreSQL backups cover posts and membership, since the search index can be rebuilt from them.
Indexed post content in OpenSearchA search index holds post text and metadata that Mattermost writes when posts are created or indexed in bulk.Confirm index names and field mappings in the Mattermost and OpenSearch documentation before writing roles against them.
Mattermost service accountA dedicated OpenSearch user that Mattermost uses to write to and query the index. It should not be an administrator account.Confirm the account has no cluster-wide admin rights and that its credentials are stored in a managed secret store.
OpenSearch roles for the service accountRoles restrict the service account to the Mattermost index patterns and the actions it needs, such as indexing and searching.Test that the account cannot read other indices, including indices used by other applications on the same cluster.
Channel and team permissionsMattermost checks channel and team membership when it runs a search and returns only posts the requesting user may already see.Run search tests as users in private channels and channels they have not joined to confirm results match Mattermost permissions.
User leaves a channelMembership changes in PostgreSQL alter what Mattermost returns, but the stored post text stays in the index.Confirm after removal that search no longer returns the user's access to the channel, and review the retention policy for indexed content.
User is deactivatedA deactivated account cannot sign in or search, but its previously written posts remain in both PostgreSQL and the index.Confirm deactivation blocks search through Mattermost, and check that no other route, such as a direct OpenSearch client, exposes the content.
OpenSearch direct accessAdministrators and analysts who sign in to OpenSearch Dashboards or the API can read indexed content independently of Mattermost.Confirm which OpenSearch users and roles can read Mattermost indices, and audit those grants with OpenSearch audit logging enabled.

Securing the OpenSearch connection

The search cluster holds a copy of Mattermost post content, so it needs the same care as the database. The cards below cover transport security, access rights, logging, network placement, credentials and backups, and each one names a check to run before the connection goes live.

TLS for node and client traffic

Enable TLS for both node-to-node and client traffic on the OpenSearch cluster, using the Security plugin's transport and HTTP layer settings. Mattermost then connects to the cluster over an encrypted channel, and certificate chains must be trusted by the Mattermost nodes that connect to it. Confirm the exact certificate and trust store settings Mattermost expects in its documentation before you issue certificates, and test the connection from every Mattermost application node, not just one.

OpenSearch security docs

Dedicated Mattermost role

Create a dedicated OpenSearch role and user for Mattermost instead of reusing an administrator account. Grant only the index permissions the search integration needs on the Mattermost post index, and deny cluster-wide administration. Document-level and field-level security are available in the Security plugin, but whether Mattermost works with these restrictions must be confirmed with Mattermost before you rely on them to limit what the connection can read.

Audit logs on the search cluster

Turn on the Security plugin's audit logging so that authentication events, failed logins and administrative changes on the search cluster are recorded. Decide where the audit records go, who can read them, and how long they are kept, because they show who queried or changed the index. Confirm which audit categories fit your retention rules, and test that the logs reach your central log store before go-live.

Network isolation

Place the OpenSearch cluster on a private subnet and allow inbound connections only from the Mattermost application nodes and from named administrator hosts. Block direct access from user networks, the internet and other application tiers. Check each rule from both sides, because a firewall that looks correct on paper can still leave the cluster reachable from a route you did not plan for.

Credential rotation and secret storage

Store the Mattermost OpenSearch password in the secrets manager your organization already uses, not in a configuration file checked into source control. Set a rotation schedule, and write down the steps for rotating the password on both the cluster and the Mattermost side so that a rotation does not cause an outage. Test one full rotation in a non-production environment before the first scheduled rotation in production.

Snapshots and backups of post content

OpenSearch snapshots contain indexed post content, so they carry the same sensitivity as the database backup. Encrypt the snapshot repository, restrict who can restore or list snapshots, and apply the same retention and deletion rules you use for other copies of messages. Confirm with Mattermost whether the search index can be rebuilt from the database, because that decides whether you need to back up the index at all.

On-premises OpenSearch or Amazon OpenSearch Service

An on-premises cluster is built from one of the OpenSearch install methods: the tarball, RPM or Debian packages, Docker, Helm, the OpenSearch Kubernetes Operator, the Ansible playbook, or Windows. Your team owns the nodes, the operating system, the TLS certificates, the JVM settings and every upgrade. Nothing is patched for you, so the security patch cadence for the OpenSearch 2.x line depends on your own change calendar.

  • Patching and upgrades: Your platform team applies OS and OpenSearch security patches during maintenance, and plans rolling upgrades that keep the cluster available for Mattermost.
  • Network paths: Build the path from the Mattermost application nodes to the search nodes on a private segment, with firewall rules limited to the Mattermost hosts and TLS on client traffic.
  • Team ownership: Storage, snapshots, node sizing, monitoring and on-call response sit with your infrastructure team.
  • Disaster recovery: Snapshots must be written to a repository you control, and a second site needs its own cluster and a tested restore path.
  • Version currency: Plan against the OpenSearch 3.x release cadence as well as 2.x maintenance, since each minor release arrives about every eight weeks.

Before you commit, confirm which installation method your standards allow and who signs off on each patch window.

Indexing existing posts and tuning for busy servers

Indexing runs in two phases, and each needs its own planning. The first is the initial bulk index of existing posts, which should run in a maintenance window, on a cluster already sized for the load, with OpenSearch heap, disk I/O, indexing rate and rejected-request counts watched the whole time. The second is ongoing indexing of new posts, which runs continuously as users write. A bulk run that looks fine in a quiet test can still push a busy cluster into rejected writes, so measure indexing throughput and queue behavior on the bulk run before you start the ongoing phase in production.

A busy Mattermost server needs OpenSearch on dedicated hosts with enough memory for the JVM heap and the operating system file cache, and enough fast disk for the index plus merge and snapshot headroom. Shard and replica counts shape both search latency and recovery. Too many small shards add overhead to every query and slow cluster state changes, while oversized shards make recovery and rebalancing slow after a node is lost. Replicas protect data and spread search load, but each one adds write work and storage. On the Mattermost side, search replicas in the database layer send search queries to a separate pool, so the OpenSearch cluster must be sized for the query volume those replicas will generate, not only for indexing.

Do not accept default shard counts, replica counts or heap settings. Validate them against the OpenSearch cluster sizing guidance in the OpenSearch cluster tuning documentation, then test them against your own measured post volume, search rate and peak concurrent users. Confirm with the Mattermost team which index and search settings your server version expects, and record the heap, shard and replica values you chose so an upgrade or a scale-out can be checked against them later.

Why the Mattermost OpenSearch connection fails

This table lists the failures teams most often hit when connecting Mattermost to OpenSearch, with the likely cause, the fix and the check that confirms the cause. Work down the rows in order, since a version or TLS problem will block everything that follows. Treat the check column as the first thing to run before changing any setting.

SymptomLikely causeFixCheck that confirms the cause
Connection test fails right after the upgradeMattermost version does not match the required OpenSearch major version (OpenSearch 2.x is required from Mattermost v12)Upgrade OpenSearch to 2.x or hold Mattermost on a release that supports your current version, then retestCompare the Mattermost server version with the OpenSearch version reported by the cluster root endpoint
Certificate error in Mattermost logsTLS chain presented by OpenSearch is not trusted by the Mattermost nodesInstall the issuing CA on every Mattermost node and confirm the full chain is served, not only the leaf certificateRun openssl s_client against the OpenSearch port from a Mattermost node and check the verify return code
401 or 403 errors when indexing or searchingService account has no index permissions on the Mattermost index patternGrant the account the minimum index and cluster privileges it needs in the OpenSearch Security plugin, then restart the connection testCheck the account's roles and the audit log entries for denied requests
Connection times out from some nodes but not othersFirewall rule blocks the search port between Mattermost nodes and the OpenSearch hostsOpen the search port from every Mattermost application node and any search replica to the OpenSearch hostsTest a TCP connection from each Mattermost node to the OpenSearch port and review firewall rules per node
Cluster health turns red or yellow after a bulk indexBulk indexing overloaded nodes or left replicas unassignedPause indexing, let the cluster recover, reduce bulk batch load and add capacity before resumingRead cluster health and unassigned shard counts, then review node heap and thread pool rejections
Shard allocation failures after a bulk indexDisks are too small or above the allocation watermarks for the index sizeAdd disk, free space or reduce replica count temporarily, then confirm shards assignReview allocation explain output and disk usage per node against the watermark settings
Search results include posts a user cannot openStale index data or permission checks that do not run against current channel membershipReindex affected channels, confirm Mattermost filters results by membership, and test with a removed user accountCompare a search result with channel membership in the database and check whether the post was deleted or the user was removed
Recent posts are missing from search after a node restartIndex updates were queued or dropped while the node was down, so the index fell behindRun an index of the missing time range and check that indexing jobs resume on every nodeCompare the newest indexed post timestamp with the newest post in the database and review Mattermost logs for indexing errors

Questions buyers ask about OpenSearch for Mattermost

What drives the cost and effort of connecting Mattermost to OpenSearch?

The main drivers are cluster sizing, whether you run dedicated hosts, the bulk indexing of existing posts, security design, testing and the upgrade path. A small pilot cluster with default security settings costs far less effort than a production cluster with dedicated nodes, TLS, identity integration, audit logging and a tested rollback. Costs split into one-time work (design, build, the initial bulk index and testing) and recurring work (patching, version upgrades and capacity changes). Ask any partner to price each of these separately in the written scope so you can see which items your own team could absorb.

How long does an OpenSearch connection and initial index take for Mattermost?

No duration can be stated in general terms because it depends on your post volume, file and message history, network throughput, host sizing and change windows. Build a pilot on a copy of a representative slice of your data, time the bulk index end to end, and extrapolate from that measurement to your full history. Track indexing rate, cluster health during the run and how long search results take to become available afterward. Use the pilot timing to set the production change window and to ask for a realistic timeline in the quote.

What does our team need to provide for an OpenSearch setup?

Plan for network access between the Mattermost servers and the OpenSearch hosts, a decision on how users and administrators authenticate, TLS certificates for node and client traffic, and an approved change window for the connection and the bulk index. You also need a named owner who can approve the design, accept the test results and carry the system after handover. If you use Amazon OpenSearch Service, confirm the account, VPC and IAM setup with your cloud team before work starts. Confirm each of these items with your own network, identity and change teams rather than assuming defaults.

Can our own team set up OpenSearch for Mattermost without a partner?

Yes, a team with Linux, Mattermost administration and search operations experience can do the work in-house, provided it has time for design, testing and a rollback plan. The areas most often underestimated are dedicated host sizing, TLS and access control on the search cluster, the bulk indexing run and ongoing patching. Your team should also decide who will handle OpenSearch version upgrades, since the project's maintenance windows for each version affect when you must move. A partner is most useful when the internal team lacks capacity, needs an independent security review, or wants the work documented for compliance evidence.

Does OpenSearch licensing add a cost to a Mattermost deployment?

The OpenSearch project is released under the Apache License, Version 2.0, and its FAQ does not describe a paid edition, so the search software itself does not carry a license fee. Your costs come from the hosts, storage, backups, staff time and, if you choose it, Amazon OpenSearch Service usage. Separately, Mattermost plan requirements must be confirmed for your use, because search features and high availability depend on the Mattermost edition and plan you hold. Confirm the plan level for each Mattermost feature you intend to use with Mattermost sales before you commit to a design.

What should we ask for in a written quote for this work?

Ask for a scope that lists each deliverable: the sizing assumptions, the host and network design, the security configuration (identity, TLS, roles and audit logging), the connection steps in the Mattermost System Console, the bulk indexing run, the test plan and the handover documents. Ask which items are fixed, which depend on pilot results, and which are excluded, such as Mattermost plan upgrades or cloud account charges. Request the assumptions about post volume and environment, the acceptance criteria, the named responsibilities on both sides, and the terms for post-delivery support or upgrades. A quote that cannot explain these items is hard to compare with an in-house estimate.

What operational risks should we check before connecting OpenSearch?

Check how the search cluster behaves under heavy indexing and query load, how it will be patched, and what happens to search if the cluster is unavailable. Confirm the wildcard deletion and index settings your team will need, the backup approach for the search data, and who monitors cluster health. Also confirm that the OpenSearch version you pick is still in maintenance for the lifetime you plan to run it, since maintenance versions receive security patches but no new features. Test a failure of one node during the pilot so you know how Mattermost responds before users depend on it.

How DeployOpen scopes and delivers the OpenSearch connection

DeployOpen plans and builds the OpenSearch connection for Mattermost inside your own infrastructure, whether that is on-premises OpenSearch or Amazon OpenSearch Service. We agree the scope, version and access model in writing first, then build, test, document and hand over the working setup to your team.

How we scope

  • Confirm your Mattermost server version and the OpenSearch 2.x line it needs before any build starts
  • Agree in writing whether OpenSearch runs on-premises or in Amazon OpenSearch Service, and which hosts are dedicated
  • Define the indexing backfill, index retention and the System Console settings your administrators will own

How we build

  • Build the OpenSearch cluster with TLS, access roles and network rules agreed during scoping
  • Write Terraform or configuration code for the hosts you choose, so the setup can be reviewed and repeated
  • Connect Mattermost, index existing posts in a controlled run, and tune settings against your observed load

How we hand over

  • Deliver test results showing search, indexing and access controls behaving as the written scope requires
  • Document the configuration, credentials handling, recovery steps and the settings your team must review
  • Walk your administrators through the setup so they can operate and change it without our involvement

How we support

  • Offer ongoing support, upgrades and continuous testing as a retainer after handover
  • Plan OpenSearch version upgrades alongside Mattermost releases, with your change approval in the loop
  • Retest the connection after material changes to Mattermost, OpenSearch or the hosting environment

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.