Skip to content

Commit 1b90543

Browse files
authored
Merge pull request #76 from diberry/diberry/0628-vector-delete-js-missing
Missing JS deleteIndex file
2 parents f29d54a + 00b5e43 commit 1b90543

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
}

0 commit comments

Comments
 (0)