Setting up Elasticsearch for Mattermost

A Mattermost team that has outgrown database search needs a dedicated Elasticsearch server, a secured network path and a controlled index build. This page sets out the supported connection method, the build order, the data that gets indexed and the checks that confirm search works.

On this page

Setting up Elasticsearch for Mattermost: what the connection does and when to use it

If your self-hosted Mattermost search has slowed down or no longer finds what users need, the usual next step is to connect Mattermost to a dedicated Elasticsearch server, so search queries run outside the database. The supported connection method, the Elasticsearch version range for your Mattermost release and the licensing terms must all be confirmed in Mattermost's own Elasticsearch documentation and on the Mattermost pricing page before any build starts, because they decide which search engine and plan you can use at all. Mattermost keeps PostgreSQL as its database of record, and Elasticsearch serves search queries alongside it. Posts are still written to PostgreSQL, so the database remains the source you back up and restore from.

Before you install anything, decide whether Elasticsearch is the right engine for your organization. Mattermost also documents OpenSearch as a search option, and the choice depends on licensing, the features you need, and how your infrastructure team already runs search clusters. Ask Mattermost to confirm which search engines are supported for your plan and release, and whether any feature you rely on is limited to a particular engine. Also plan the dedicated host: confirm the Elasticsearch version and its hardware, JVM heap and disk requirements with the vendor, and decide who owns patching, certificates and index health after go-live.

Plan for two one-time operations and one recurring cost. The one-time work is the initial connection in the System Console and the bulk indexing of existing posts, which can take a long time on a large history and should be scheduled in a quiet window. The recurring work is running and securing the Elasticsearch cluster: upgrades, storage growth, backups of the search data, and monitoring. When you ask a partner for a quote, ask them to price the written scope against your post volume, the number of hosts, and who will operate the cluster after handover.

What you need in place before installing Elasticsearch for Mattermost

Each card below is a gate you should clear before touching a server. Together they decide whether the Elasticsearch host you build will be supported by Mattermost, reachable from every application node, and secured in a way your security team will accept.

Mattermost server version and plan

Confirm your running Mattermost server version and that your plan includes Elasticsearch search. Check the current Mattermost pricing page for which plan level includes it, and confirm with your Mattermost account contact or sales team before you buy. Also check the server release you run against the Mattermost server releases page, since support windows determine when you must upgrade.

Pricing page

Supported Elasticsearch version

Confirm the exact Elasticsearch 8.x or 9.x release against Mattermost's compatibility table before you download anything. Mattermost's documentation for the search integration states which versions it supports for your server version. Record the version in your change request, and ask your Mattermost contact whether a newer Elasticsearch minor release has been validated. Elasticsearch licensing and features differ from OpenSearch, so confirm your licensing position with your legal or procurement team.

Dedicated host sized from reference architectures

Plan a server dedicated to Elasticsearch rather than sharing it with the application or database. Size CPU, memory, and disk from Mattermost's published reference architectures for your concurrent user count, then validate with a pilot index on realistic post volume. Ask your infrastructure team who owns patching, snapshots, and capacity alerts for this host before the build starts.

Network reachability between nodes

Map every Mattermost application node that must reach the search host, and the ports each one uses. Open that path only from those nodes, and keep the Elasticsearch HTTP port off public networks and load balancers. Work with your network or cloud team to confirm firewall rules, security groups, and DNS names, and test from each application node before you change any System Console setting.

TLS certificates and service credentials

Decide how Mattermost will trust the Elasticsearch endpoint before the install. Obtain a certificate from your internal certificate authority for the search hostname, and create a dedicated Elasticsearch user with only the privileges Mattermost needs. Store the credentials in your secrets manager, and agree with your security team how rotation and revocation will work, since the System Console connection will hold them.

How Mattermost sends search and indexing traffic to the search server

Users and clients reach the Mattermost application nodes through a load balancer, and those nodes write posts and other data to the PostgreSQL primary. Search queries and bulk indexing jobs leave the application nodes and travel over a restricted network segment to the dedicated Elasticsearch host, which is the trust boundary to check. Administrators make the same connection through the System Console, so confirm that the search host accepts traffic only from the application tier and that the connection settings match what you configured on the server.

Request and indexing paths between clients, Mattermost, PostgreSQL and the dedicated search host.

Configuring Elasticsearch for Mattermost in the right order

This sequence takes a dedicated Elasticsearch host from a fresh install to a verified connection in the Mattermost System Console, with a check at each step so problems surface before search is switched on for users.

  1. Install Elasticsearch on the dedicated host

    Install the Elasticsearch 8 or 9 package on the dedicated server, not on a Mattermost application node, and confirm the version against the Mattermost server release notes for the Mattermost version you run. Your team or the DeployOpen engineer performs the install from the official package repository. Confirm the installed version with the package manager and the node's version output before going further. The step is done when the binary reports the expected version and the host has no other search service competing for the same ports.

  2. Enable the service under systemd

    Enable the Elasticsearch unit so it starts on boot, then start it and read its status and journal output for startup errors such as heap or file descriptor limits. Reboot the host once, then check that the service returns to active state without manual intervention. Keep the JVM heap and memory settings as the package defines them unless your sizing review says otherwise. The check is a clean journal after the reboot and an active service status.

  3. Bind HTTP and transport to the private address

    Edit the node settings file to set the network host for both the HTTP and transport interfaces to the private address of the dedicated host, so the cluster does not listen on all interfaces. Restrict the host's firewall so only Mattermost application nodes can reach the HTTP port and only the cluster's own nodes can reach the transport port. Restart the service and confirm with a socket listing that the ports are bound to the private address only. Ask your network team to confirm the firewall rules in writing before the next step.

  4. Enable authentication and TLS

    Turn on Elasticsearch security features, including authentication and TLS on the HTTP layer, and create a dedicated user with only the privileges Mattermost needs for its search index. Store the credentials in your secrets manager, not in a shared file. Verify that an unauthenticated request is refused and that the authenticated request succeeds over HTTPS. Confirm the exact privilege set and certificate requirements against Elastic's current security documentation and the Mattermost search setup guide for your version, since these settings change between releases.

  5. Confirm cluster health from a Mattermost node

    From a Mattermost application node, not from the search host itself, send an authenticated request to the cluster health endpoint using the CA certificate and the dedicated user. A healthy response with a green or expected yellow status confirms that the node can reach the cluster and that the certificate chain is trusted. If the request fails, check the firewall rule, the bind address and the certificate subject name before changing any Mattermost setting. Record the response for your change log.

  6. Review the wildcard index deletion setting

    Before you change the setting that controls wildcard index deletion, confirm its current value and the recommended value against Elastic's current guidance for your version and against Mattermost's requirement for the search integration. Changing this setting affects how indices can be removed by pattern, so the decision belongs to the platform owner and should be recorded. Make the change only after the owner signs off, then verify it by reading the cluster settings back. The check is a settings read showing the agreed value.

  7. Enter the connection details in the System Console

    Sign in to Mattermost as a system administrator, open the System Console, go to the Elasticsearch search settings and enter the connection URL, the dedicated username and the password from your secrets store. Trust the CA certificate as your configuration requires, then save. Use the connection test in the console if your version provides one. The step is done when the console reports a successful connection and the setting is saved without errors in the server log.

  8. Run a test search and index existing posts

    After the connection succeeds, run a test search for a known term in a test channel and confirm that results return. Then start the bulk indexing of existing posts only after confirming the indexing window and load impact for your post volume with the Mattermost documentation for your version. Monitor the search host's health and the server logs while indexing runs. The sequence is complete when a test search returns the expected post and the index reports the expected document count.

Bulk indexing existing posts without disrupting the running server

Existing posts are not searchable in Elasticsearch until they are indexed, so connecting the server is only the first step. The bulk indexing run copies historical messages from PostgreSQL into the search index, and it is the step most likely to slow a live server. Treat it as a planned change with a window, a rollback position and a verification step, not as a background task you start and forget. Confirm the exact indexing command, its flags, whether it can be resumed, and how it reports progress in Mattermost's documentation for the release you run, because these details change between versions. Then rehearse the full run on a staging copy of the database and the Elasticsearch node so you learn its real duration and resource profile before production.

Schedule the run in a low-traffic window and watch both sides of the connection for the whole run. On the Mattermost side, watch CPU, memory, disk I/O and network on the application servers and the database, since the indexer reads heavily from PostgreSQL. On the Elasticsearch host, watch heap pressure, CPU, disk space and indexing queue rejections, and be ready to lower the run's intensity or stop it if user-facing latency climbs. Keep the cluster's disk headroom in view, because the new index can grow quickly while the existing posts are loaded. Plan for a stop and restart so the team knows whether the command resumes safely or must start over, and record who has authority to halt it.

After the run finishes, verify that the index holds what the database holds. Compare the number of indexed post documents with the post count you query directly from PostgreSQL for the same scope, and note the time boundary you used so ongoing posts are not counted as missing. Then run a few searches as a normal user across channels and date ranges you know well, and confirm that results match what the user can see in the client. Keep the run log, counts and sample searches with your change record. A count mismatch is a reason to investigate and re-run the relevant portion before users are told that search covers their history.

Which Mattermost data goes to Elasticsearch and what stays in PostgreSQL

This table compares, for each data category, where the authoritative copy lives, what the Elasticsearch index holds, and what you should check before go-live. Read it as a boundary map: PostgreSQL remains the system of record, so the index can be dropped and rebuilt from it, but the exact indexed fields depend on your Mattermost version.

Data categoryAuthoritative copyWhat the search index holdsWhat to confirm
Channels and messagesPostgreSQL databasePost text used for search queries, indexed from the database by the bulk indexing jobConfirm in the docs for your version which post fields and channel membership data are indexed
Users and team membershipPostgreSQL database, plus your identity provider for sign-inUser and channel membership information used to filter results to what each user can seeCheck that permission filtering returns only channels the searching user belongs to, using a test account
File attachments and metadataFile store (local disk, NAS or S3) with metadata in PostgreSQLFile names and extracted attachment metadata where your version supports file search; file contents are not assumedConfirm whether attachment content is indexed in your version and whether file storage is a separate backup scope
Search results shown in the clientComputed at query time from Elasticsearch hits, then checked against PostgreSQL permissionsOnly matching IDs and ranking data, not a separate copy of the message historyTest deleted posts, edited posts and archived channels to confirm results stop appearing after changes
Deletions and retention changesPostgreSQL, where deletion and retention are recordedIndex entries that must be removed when content is deleted, which depends on the wildcard deletion settingConfirm the deletion setting and run a deletion test after any retention policy change
Index rebuild after lossNot applicable, the index is derived dataRebuilt by bulk indexing existing posts from PostgreSQLPlan the rebuild time on a copy of your database before relying on it for recovery

Securing the Elasticsearch node and its credentials for Mattermost

The Elasticsearch node sits on the boundary between Mattermost's application nodes and the search data they index. The controls below keep that boundary narrow: who can reach the cluster, what credentials can do, where secrets live, and how access is recorded. Confirm each item against your own security baseline before the node takes production traffic.

Restrict network access to Mattermost nodes

Allow inbound connections to the Elasticsearch HTTP port only from the Mattermost application nodes, and block every other source, including user workstations and other application tiers. In the trust boundary diagram this is the first wall between the search node and the rest of the network. Confirm the allowed source list with your network team, and confirm that any search replicas or proxies you add are listed explicitly rather than covered by a broad subnet rule.

Enable authentication and TLS

Turn on Elasticsearch security features so that every HTTP and transport connection requires authentication and is encrypted, including traffic between cluster nodes. Without this, anyone who can reach the port can read or alter indexed posts. Confirm the TLS version, certificate chain and cipher policy with your security team, and confirm that Mattermost is configured to trust the CA that issued the certificates.

Store credentials and certificates in a secrets store

Keep the Elasticsearch password, API key and certificate private keys in a secrets manager, not in plain configuration files or the Mattermost config directory that is copied into backups. Restrict read access to the service accounts that need it, and plan rotation as a routine task. Confirm with your security team which secrets platform is approved and who approves rotation.

Limit the service account to Mattermost indexes

Create a dedicated Elasticsearch role for Mattermost that can read, write and manage only the index patterns it uses, and no cluster-wide administrative privileges. This limits damage if the credential leaks and keeps other data on a shared cluster out of reach. Confirm the exact index names and privileges with the Mattermost documentation for your version, and confirm that the wildcard deletion setting is reviewed as part of this role design.

Keep the host patched

Apply operating system and Elasticsearch security updates on the vendor's release schedule, and test them against a non-production copy of the cluster before the production node. Unpatched search hosts are a common path into the trust boundary because they sit on a network segment with access to indexed content. Confirm your patch window, your rollback plan and the Elasticsearch version compatibility with your Mattermost release before each change.

Log access to the cluster

Enable Elasticsearch audit logging for authentication events, access denials and administrative changes, and forward those logs to your central log platform. Review failed logins and unexpected index operations, and confirm that log retention meets your records policy. Confirm with your security operations team which events they need, where the logs are stored, and who can read them.

Why Elasticsearch search fails after Mattermost is connected

This table lists the failures teams most often hit after connecting Elasticsearch to Mattermost, with the likely cause and a check to run for each. Work down the rows in order: confirm the cluster is healthy and reachable first, then confirm the index has been populated, since most search complaints trace back to one of these two steps.

SymptomLikely causeFix and check to run
System Console connection test failsMattermost cannot reach the Elasticsearch host and port, or the URL uses the wrong schemeFrom the Mattermost server, run curl against the Elasticsearch URL to confirm the port answers. Check that the Connection URL in the System Console matches the scheme and port the node listens on, and that firewall rules allow traffic from the Mattermost application servers.
Search returns nothing for older postsThe bulk indexing job for existing posts was never run, so only new posts are indexedRun the bulk indexing step from the Mattermost command line tooling against the existing history, then search for a term from a post made months ago. Confirm the exact command and flags in the Mattermost documentation for your server version.
Searches time out under loadThe Elasticsearch heap or CPU is undersized for query volume, or the node shares its host with other servicesCheck heap pressure and query latency in the Elasticsearch node stats endpoint during a busy period. Move Elasticsearch to a dedicated host and size it from the Mattermost reference architecture for your user count before raising timeouts.
Certificate trust errors between nodes or from MattermostThe CA that signed the Elasticsearch certificate is not in the trust store used by Mattermost or by other cluster nodesVerify the chain with openssl s_client against the Elasticsearch port from the Mattermost host. Add the CA certificate to the trust store that Mattermost uses, and confirm the certificate subject names match the host name in the connection URL.
Cluster status shows yellowOne or more replica shards are unassigned, often because the cluster has fewer nodes than the replica setting expectsRun the cluster health API and the cat shards view to list unassigned shards and the reason. On a single node, set replicas to zero for the Mattermost indexes or add a second node, and confirm the status returns to green.
Cluster status shows redAt least one primary shard is unavailable, so some indexed data cannot be searchedIdentify the red indexes with the cat indices view and the allocation explain API. Restore the failed node or its data directory from backup before reindexing. Do not delete the index until you have confirmed what is missing.
Index writes stop and new posts are not indexedA disk watermark has been reached, which blocks writes to the affected indexesCheck free disk space on each data path and the cluster settings for the watermark thresholds. Free space or add capacity, then clear the read-only block on the affected indexes once space is back below the thresholds. Confirm the exact setting names for your Elasticsearch version.
Search behavior differs after a version changeMattermost and Elasticsearch version support can change between Mattermost releases, and the supported range is version-specificCompare your Elasticsearch version with the supported versions listed in the Mattermost release notes for your server version before upgrading either product. Mark this check for confirmation against the Mattermost release notes each time you upgrade.

What setting up Elasticsearch for Mattermost costs, takes and requires from your team

What drives the cost of setting up Elasticsearch for Mattermost?

The cost comes from four components: the dedicated server, the Elasticsearch subscription or license tier needed for the features you plan to use, the Mattermost plan level, and the labor to build and run the bulk index. The server and any Elasticsearch subscription recur, usually on the infrastructure or vendor billing cycle. Mattermost sells Professional, Enterprise and Enterprise Advanced plans as prepaid annual subscriptions priced by seat licenses, so the plan cost scales with user count. The build, testing and initial bulk index are one-time labor costs, while patching and upgrades recur. Ask each quote to show who pays for the host, the Elasticsearch subscription, the Mattermost subscription and the implementation work, so you can compare it with your internal estimate line by line.

Which Mattermost plan do I need to use Elasticsearch search?

Confirm the plan entitlement with Mattermost before you buy anything, because the supplied pricing information does not settle this question. The Mattermost pricing page lists SSO and AD/LDAP sync from the Professional plan, high availability clustering and FIPS 140-3 compliance from Enterprise, and air-gapped deployment in Enterprise Advanced. Search requirements are not listed in that summary, so ask your Mattermost account contact to confirm in writing which plan covers the Elasticsearch integration in your version. Check the Mattermost pricing page for the current plan breakdown, then match it to the Elasticsearch features and licensing your security team has approved.

How long does an Elasticsearch setup for Mattermost take?

The duration depends on how quickly your environment can be reached and how much data must be indexed, so no fixed timeline applies to every deployment. The main variables are access to the host and network, certificate issuance from your internal certificate authority, the size of the post history to index, and the change windows your operations team allows for the cutover and bulk index. A staging copy that matches production lets the build and test phases run in parallel with approvals. Ask for milestones with dependencies named, such as access granted, certificates issued, staging validated and production window booked, so you can see which delays sit with your team and which sit with the implementer.

Can our Linux and search team set up Elasticsearch for Mattermost alone?

A team with solid Linux administration, systemd, TLS and Elasticsearch operations experience can usually build the service alone, provided it also has staging access and time for testing. The gaps tend to be Mattermost-specific: the System Console connection settings, how the bulk indexing of existing posts behaves, and how to confirm search results after the index completes. Teams without Elasticsearch operations experience often underestimate node security, index lifecycle and recovery steps. If your staff lack one of these areas, a fixed-scope engagement can cover the build, handover documentation and a supervised bulk index run, while your team keeps ownership of the running system.

What must our team provide before Elasticsearch setup work starts?

Your team needs to supply four inputs before the work can start:

  • Host access: a dedicated server or VM with administrative access, the operating system version agreed in advance, and a named owner for patching.
  • Network rules: firewall changes that allow Mattermost to reach the Elasticsearch port and restrict everything else, plus the binding address and any internal DNS names.
  • A staging copy: a non-production Mattermost environment with a recent copy of the database, so the bulk index and search tests run before production.
  • Change window sign-off: an approved window for the production index run, with a rollback decision owner.

Also provide certificates from your internal authority and a Mattermost System Console administrator account for the connection test.

What should a written quote for Elasticsearch setup for Mattermost include?

A usable quote states the scope in enough detail that either party can tell when the work is complete. Ask for the Elasticsearch version and the host count, the systemd service and network binding details, the wildcard deletion setting, the System Console connection steps, and the bulk index procedure for existing posts. Deliverables should list the configuration files, a runbook and the test results. The quote should also state assumptions such as the data volume, environment access and change windows, and what is excluded, including software licenses, hosting and ongoing support. Check that the timeline names dependencies and the acceptance criteria. DeployOpen agrees scope, deliverables and timelines in writing before work starts, and the price follows from that written scope.

What happens if the bulk index run takes longer than planned?

A long bulk index usually delays search availability for older posts, while new posts may still depend on how the indexing is configured, so confirm the behavior in the Mattermost documentation for your version before the window. Plan for a longer run by sizing the change window with margin, testing the run time on a staging copy with comparable data, and agreeing in advance who decides whether to pause, continue or roll back. Ask the implementer to document how to resume or re-run the index without corrupting results, and how to confirm completeness afterward. Keep the search service monitored during the run so the operations team sees resource pressure early.

How DeployOpen scopes, builds and supports Mattermost search in your infrastructure

DeployOpen approaches Elasticsearch for Mattermost as a scoped piece of work inside infrastructure you control, from the dedicated search server through to the bulk indexing of existing posts. The written scope sets what is built, tested, documented and handed over, and ongoing support can follow as a retainer.

How we scope

  • Confirm your Mattermost server version and whether it runs on Linux, Kubernetes or containers before choosing Elasticsearch settings
  • Agree the Elasticsearch version (8 or 9), host sizing, network segment and which Mattermost users can reach the search server
  • Record in writing the existing post volume to index, the indexing window and who approves the cutover to Elasticsearch search

How we build

  • Install Elasticsearch on a dedicated server with a systemd unit, service account and file permissions set to your standards
  • Bind the network interface, restrict access to the Mattermost servers and confirm TLS and authentication are enabled before connecting
  • Set the wildcard deletion configuration, connect the server from the System Console and run the bulk indexing job with recorded checks

How we hand over

  • Deliver a runbook covering installation, service configuration, network rules, the wildcard deletion setting and the indexing steps
  • Provide test evidence showing search results, indexing completion and the connection settings used in the System Console
  • Walk your administrators through restart, index health checks, log locations and the steps to re-index after a failed run

How we support

  • Offer ongoing support, Elasticsearch version upgrades and Mattermost release compatibility checks as a retainer
  • Plan upgrades around the Mattermost monthly release and the Extended Support Release schedule, confirmed against current vendor pages
  • Retest search after each upgrade or configuration change and update the runbook so your team keeps current documentation

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.