Merge pull request #32386 from nojaf/fix-opensearch-bulk

fix(search-backend-module-elasticsearch): improve index refresh
This commit is contained in:
Andre Wanlin
2026-02-02 07:32:12 -06:00
committed by GitHub
3 changed files with 9 additions and 2 deletions
@@ -0,0 +1,5 @@
---
'@backstage/plugin-search-backend-module-elasticsearch': patch
---
Fixed bulk indexing to refresh only the target index instead of all indexes, improving performance in multi-index deployments.
@@ -60,10 +60,11 @@ describe('ElasticSearchSearchEngineIndexer', () => {
bulkSpy,
);
refreshSpy = jest.fn().mockReturnValue({});
// Use specific pattern to avoid conflict with /some-type-index__* wildcard mock
mock.add(
{
method: 'GET',
path: '/:index/_refresh',
path: '/some-type-index__:ts/_refresh',
},
refreshSpy,
);
@@ -97,7 +97,8 @@ export class ElasticSearchSearchEngineIndexer extends BatchSearchEngineIndexer {
: {}),
};
},
refreshOnCompletion: options.skipRefresh !== true,
refreshOnCompletion:
options.skipRefresh !== true ? that.indexName : false,
});
// Safely catch errors thrown by the bulk helper client, e.g. HTTP timeouts