Delete Indices
Deletion will permanently remove an index and associated records from your application.
Deletion may not be your only option. If you want to reduce your usage, remove the records from an index (clear it) through either the dashboard’s Indices section or the API.
삭제가 유일한 옵션은 아닐 수 있습니다. 사용량을 줄이려면 대시보드의 인덱스 섹션 또는 API를 통해 인덱스에서 레코드를 제거합니다.
If you want to keep a backup of an index, export it. You can also save your index’s configuration data.
인덱스의 백업을 유지하려면 해당 인덱스를 내보내십시오. 인덱스의 구성 데이터도 저장할 수 있습니다.
Deleting one index#
To delete a single index, you can use the dashboard or API.
Delete an index using the dashboard#
- Select an index.
- In the Browse tab, click the Manage index drop-down and select Delete.
- Confirm your request by typing DELETE into the pop-up box and then click Delete.
Delete an index using the API#
Use the deleteIndex method on the index you want to delete.
index.delete().then(() => {
// done
});
Deleting multiple indices using the API
You can’t delete multiple indices at once using the dashboard.
There isn’t a direct method to delete multiple indices, but you can write a script to loop through and delete the indices you want.
For example, if you’re running tests with indices that you generated with the prefix test_, you might want to purge them from your application from time to time.
예를 들어 접두사 test_를 사용하여 생성한 인덱스를 사용하여 테스트를 실행하는 경우 응용 프로그램에서 해당 인덱스를 때때로 제거할 수 있습니다.
Deleting all indices(모든 인덱스 삭제)
- List all your indices.
- Loop through all primary indices and delete them.
- If you want to delete replica indices, you must detach them from their primary index. If there are replicas, wait for the deletion of their primary indices for them to automatically detach, then loop through and delete the replicas.
1.모든 인덱스를 나열하십시오.
2.모든 기본 인덱스를 반복하여 삭제합니다.
3.복제본 인덱스를 삭제하려면 복제본 인덱스를 주 인덱스에서 분리해야 합니다. 복제본이 있는 경우, 기본 색인이 자동으로 분리될 때까지 기다린 후 복제본을 반복하여 삭제합니다.
// Primary indices only
client.listIndices().then(({ items }) => {
const ops = items
.filter(({ name, primary }) => !primary)
.map(({ name }) => {
return {
indexName: name,
action: 'delete',
};
});
return client.multipleBatch(ops).then(({ objectIDs }) => {
console.log(objectIDs);
});
});
// Primary and replica indices
client.listIndices().then(({ items }) => {
const { primaryOps, replicaOps } = items.reduce(
(memo, { name, primary }) => {
memo[primary ? 'primaryOps' : 'replicaOps'].push({
indexName: name,
action: 'delete',
});
return memo;
},
{ primaryOps: [], replicaOps: [] }
);
return client
.multipleBatch(primaryOps)
.wait()
.then(() => {
console.log('Done deleting primary indices');
return client.multipleBatch(replicaOps).then(() => {
console.log('Done deleting replica indices');
});
});
});
Deleting some indices#
Deleting some indices is like deleting them all, except you must add a step to select the indices you want.
일부 인덱스를 삭제하는 것은 원하는 인덱스를 선택하는 단계를 추가해야 한다는 점을 제외하고는 모두 삭제하는 것과 같습니다.
client.listIndices().then(({ items }) => {
const ops = items
.filter(({ name }) => name.includes('test_'))
.map(({ name }) => {
return {
indexName: name,
action: 'delete',
};
});
client.multipleBatch(ops).then(({ objectIDs }) => {
console.log(objectIDs);
});
});
'개발 > ALGOLIA' 카테고리의 다른 글
알고리아 Sending And Managing Data(2-21) (0) | 2022.03.02 |
---|---|
알고리아 Sending And Managing Data(2-20) (0) | 2022.03.02 |
알고리아 Sending And Managing Data(2-18) (0) | 2022.03.02 |
알고리아 Sending And Managing Data(2-17) (0) | 2022.03.01 |
알고리아 Sending And Managing Data(2-16) (0) | 2022.03.01 |