Skip to content

WPB-28665: remove ElasticSearch; query user search from Postgres - #5539

Open
blackheaven wants to merge 1 commit into
developfrom
gdifolco/WPB-28655-migrate-user-search-postgresql
Open

blackheaven wants to merge 1 commit into
developfrom
gdifolco/WPB-28655-migrate-user-search-postgresql

Conversation

@blackheaven

@blackheaven blackheaven commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

https://wearezeta.atlassian.net/browse/WPB-28665

Checklist

  • Add a new entry in an appropriate subdirectory of changelog.d
  • Read and follow the PR guidelines

ElasticSearch backed exactly one feature area: brig user indexing.
Delete the projection entirely and query brig's Postgres wire_user table
directly via a new UserSearchStore Polysemy effect.

New:
- Wire.UserSearchStore effect: searchUsers, searchUsersFederated,
  paginateTeamMembers, getTeamSize, setTeamSearchVisibilityInbound
- Wire.UserSearchStore.Postgres interpreter porting the ES semantics:
  shouldIndex candidate filter, documented swagger rank order, visibility
  via team_search_visibility (default own-team-only), app exclusion,
  tokenized prefix matching with LIKE escaping, keyset pagination
- Wire.UserSearch.Normalize (ICU Any-Latin;Latin-ASCII;Lower, formerly
  the ES 'normalized' field) now stored in wire_user.name_normalized
- migration: name_normalized + text_pattern_ops indexes +
  team_search_visibility table
- brig-index reduced to 'backfill-normalized-names' (run once before
  cutover; pre-backfill rows lack name_normalized)
- in-memory mock for MiniBackend unit tests

Deleted:
- Wire.IndexedUserStore*, Wire.UserSearch.{Types,Migration,Metrics},
  Wire.UserStore.IndexUser, GetIndexUser/GetIndexUsersPaginated store ops
- Brig.Index.*, Brig.User.Search.{Index,SearchIndex}, IndexEnv/mkIndexEnv
- ISearchIndexAPI routes (/i/index/*), galley updateSearchIndex push,
  index-sync call sites, counter metrics
- bloodhound dependency, tools/db/find-undead, elasticsearch/kibana
  charts, opensearch releases, dockerephemeral ES services, ES test
  fixtures and ES-specific integration tests

Deployment: run `brig-index backfill-normalized-names --pg-settings ...`
after this migration and before search cutover.

Known env-only build failures (untouched packages): integration
Certs.hs (crypton-x509/pem solver skew), spar/federator/stern
integration exes (hidden Test.Hspec.JUnit), extended/saml2 (missing
shared libssl).
@blackheaven
blackheaven requested review from a team as code owners September 11, 2026 17:47
@zebot zebot added the ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist label Sep 11, 2026
@blackheaven blackheaven changed the title feat(brig): remove ElasticSearch; query user search from Postgres WPB-28665: remove ElasticSearch; query user search from Postgres Sep 11, 2026
@blackheaven blackheaven added the ready-for-review looking actively for reviewer label Sep 11, 2026

@fisx fisx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be awesome, but the ticket doesn't really say anything about re-architecting anything? Also, shouldn't we do some load testing before we merge this? Or maybe after, before the next release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Approved for running tests in CI, overrides not-ok-to-test if both labels exist ready-for-review looking actively for reviewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants