AWS OpenSearch bulk index only indexes a single day

Applies to: Mattermost Self-Hosted v9.11 and later using AWS OpenSearch Service for Enterprise Search
Symptoms: Bulk index job reports success but only indexes current day's posts; historical data missing from search results

Problem

When running a bulk index job against AWS OpenSearch, only a single day of data is indexed even though the job reports success. Historical data remains missing from search results. Running Bulk Index does not backfill historical content.

AWS OpenSearch blocks wildcard destructive operations that the Mattermost purge process relies on. Attempts to manually purge or delete indices do not resolve the issue.

Symptoms

Users experiencing this issue will see:

flush: 404 page not found

Additional symptoms include:

  • Successful bulk index job messages but only one day of data indexed
  • Purge Indexes command failing silently or partially completing
  • AWS OpenSearch restrictions preventing action.destructive_requires_name=false from being set

Solution

Follow these steps to resolve the indexing issue and backfill historical data:

Add Ignored Purge Indexes

Navigate to System Console → Environment → Elasticsearch → Indexes to skip while purging and add the following configuration:

.plugins-*,.kibana*,.opendistro*,.opensearch*,.ql-*,.tasks* 

This ensures Mattermost skips protected AWS system indices during purge operations.

Purge and Reindex

Perform the following actions in order:

  1. Disable Elasticsearch indexing
  2. Re-enable Elasticsearch indexing
  3. Run Purge Indexes
  4. Run Index Now

Remove Old Indexing Jobs

Old indexing jobs should be deleted from the database. First, verify existing jobs:

SELECT Id, Type, Data, CreateAt, Status
FROM Jobs
WHERE Type = 'elasticsearch_post_indexing'
ORDER BY CreateAt DESC; 

Delete the old indexing jobs:

DELETE FROM Jobs
WHERE Type = 'elasticsearch_post_indexing'; 

Verify the deletion:

SELECT COUNT(*)
FROM Jobs
WHERE Type = 'elasticsearch_post_indexing'; 

After deleting the old jobs, trigger Bulk Indexing again, and historical data should begin to populate.

Check OpenSearch Templates (Optional)

If needed, verify index templates using the following command:

curl -X GET <OPENSEARCH_URL>/_index_template -u USER:PASS 

 

Important: Ensure you have a database backup before deleting jobs from the database. The purge and reindex process may take significant time depending on the volume of historical data.
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.