Commit 7a8cf44
authored
⚡(search) use bulk API and prefetching for reindex_all (#595)
The previous implementation indexed each thread and message with individual
OpenSearch HTTP calls and triggered N+1 DB queries for accesses, recipients
and sender lookups. This rewrites reindex_all to batch documents via
opensearchpy.helpers.bulk and prefetch related objects in a single queryset,
drastically reducing both DB round-trips and HTTP overhead.1 parent 1767e17 commit 7a8cf44
File tree
5 files changed
+532
-238
lines changed- src/backend/core
- management/commands
- services/search
- tests/search
5 files changed
+532
-238
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
152 | 153 | | |
153 | 154 | | |
154 | 155 | | |
155 | | - | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
156 | 165 | | |
157 | 166 | | |
158 | 167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1306 | 1306 | | |
1307 | 1307 | | |
1308 | 1308 | | |
1309 | | - | |
1310 | | - | |
1311 | | - | |
1312 | | - | |
| 1309 | + | |
| 1310 | + | |
1313 | 1311 | | |
1314 | 1312 | | |
1315 | 1313 | | |
| |||
1347 | 1345 | | |
1348 | 1346 | | |
1349 | 1347 | | |
1350 | | - | |
| 1348 | + | |
1351 | 1349 | | |
1352 | 1350 | | |
1353 | 1351 | | |
| |||
0 commit comments