I definitely imported posts, but search API always return empty

Summary
Thank you for the detailed help! I finally am able to import my slack data into a local deployed mattermost service. But I can’t seem to search any post.

Steps to reproduce
I can’t send you the data. But I can give what I did exactly.

I first verified that there are posts in the system:

# Get list of channels
curl -H 'Authorization: Bearer 123' \
  http://localhost:8065/api/v4/channels

# Get 3 messages from the channel
curl -H 'Authorization: Bearer 123' \
  http://localhost:8065/api/v4/channels/{channel_id}/posts?per_page=3

# Search the same post with post search
curl --request POST \
  --url http://localhost:8065/api/v4/teams/{team_id}/posts/search \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer 123' \
  --header 'Content-Type: application/json' \
  --data '{
  "terms": "computer",
  "per_page": 3
}'

Expected behavior
I should be able to find the post I just listed from the channel.

Observed behavior
Instead I observe:

{"order":[],"posts":{},"next_post_id":"","prev_post_id":"","first_inaccessible_post_time":0,"matches":null}

I don’t get any error message from mattermost in log or response. Also the empty results come back really fast.

I want to add that so far I only have 1 team in the mattermost db. And I verified that the channel I listed all have the right team_id. Very strange indeed!

I think by default mattermost uses database’s text search capabilities. And I double checked that in the config.json, both elasticsearch and bleve are disabled. And for database, "DisableDatabaseSearch": false,

I also turned on debug log and oberved following:

{"timestamp":"2025-06-10 19:51:33.062 Z","level":"debug","msg":"Received HTTP request","caller":"web/handlers.go:175","method":"POST","url":"/api/v4/teams/{team_id}/posts/search","request_id":"411qtzahqib4ukqazccnkbae1r","user_id":"f1cxt9er1tdepmdex9ikhfx3kc","status_code":"200"}

So status code is 200, and there are no go errs. :frowning:

I also tried the cross team search:

curl --request POST --url http://localhost:8065/api/v4/posts/search --header 'Accept: application/json' --header 'Authorization: Bearer 123' --header 'Content-Type: application/json'   --data '{
  "terms": "computer use"
}'

Still got empty results.