File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { DefaultAzureCredential } from "@azure/identity" ;
2
+ import {
3
+ SearchIndexClient
4
+ } from "@azure/search-documents" ;
5
+
6
+ const credential = new DefaultAzureCredential ( ) ;
7
+ export const searchEndpoint = process . env . AZURE_SEARCH_ENDPOINT ;
8
+ export const indexName = process . env . AZURE_SEARCH_INDEX_NAME ;
9
+
10
+ console . log ( `Using Azure Search endpoint: ${ searchEndpoint } ` ) ;
11
+ console . log ( `Using index name: ${ indexName } ` ) ;
12
+
13
+ const searchIndexClient = new SearchIndexClient ( searchEndpoint , credential ) ;
14
+
15
+ try {
16
+ console . log ( "Deleting index..." ) ;
17
+ await searchIndexClient . deleteIndex ( indexName ) ;
18
+ console . log ( `Index ${ indexName } deleted` ) ;
19
+ } catch ( ex ) {
20
+ console . error ( "Failed to delete index:" , ex ) ;
21
+ }
You can’t perform that action at this time.
0 commit comments