Full parallel implementation of typesense and opensearch
This commit is contained in:
@@ -611,6 +611,79 @@ export const configApi = {
|
||||
},
|
||||
};
|
||||
|
||||
// Search Engine Management API
|
||||
export const searchAdminApi = {
|
||||
// Get migration status
|
||||
getStatus: async (): Promise<{
|
||||
primaryEngine: string;
|
||||
dualWrite: boolean;
|
||||
typesenseAvailable: boolean;
|
||||
openSearchAvailable: boolean;
|
||||
}> => {
|
||||
const response = await api.get('/admin/search/status');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// Configure search engine
|
||||
configure: async (config: { engine: string; dualWrite: boolean }): Promise<{ message: string }> => {
|
||||
const response = await api.post('/admin/search/configure', config);
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// Enable/disable dual-write
|
||||
enableDualWrite: async (): Promise<{ message: string }> => {
|
||||
const response = await api.post('/admin/search/dual-write/enable');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
disableDualWrite: async (): Promise<{ message: string }> => {
|
||||
const response = await api.post('/admin/search/dual-write/disable');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// Switch engines
|
||||
switchToOpenSearch: async (): Promise<{ message: string }> => {
|
||||
const response = await api.post('/admin/search/switch/opensearch');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
switchToTypesense: async (): Promise<{ message: string }> => {
|
||||
const response = await api.post('/admin/search/switch/typesense');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// Emergency rollback
|
||||
emergencyRollback: async (): Promise<{ message: string }> => {
|
||||
const response = await api.post('/admin/search/emergency-rollback');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
// OpenSearch operations
|
||||
reindexOpenSearch: async (): Promise<{
|
||||
success: boolean;
|
||||
message: string;
|
||||
storiesCount?: number;
|
||||
authorsCount?: number;
|
||||
totalCount?: number;
|
||||
error?: string;
|
||||
}> => {
|
||||
const response = await api.post('/admin/search/opensearch/reindex');
|
||||
return response.data;
|
||||
},
|
||||
|
||||
recreateOpenSearchIndices: async (): Promise<{
|
||||
success: boolean;
|
||||
message: string;
|
||||
storiesCount?: number;
|
||||
authorsCount?: number;
|
||||
totalCount?: number;
|
||||
error?: string;
|
||||
}> => {
|
||||
const response = await api.post('/admin/search/opensearch/recreate');
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
|
||||
// Collection endpoints
|
||||
export const collectionApi = {
|
||||
getCollections: async (params?: {
|
||||
|
||||
Reference in New Issue
Block a user