Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add script for deleting tags #19

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions index-delete.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import AlgoliaSearch from 'algoliasearch';

import 'dotenv/config'

let client = null;
let index = null;

const { ALGOLIA_APP_ID, ALGOLIA_ADMIN_KEY } = process.env

function init(indexName) {
if (!client) client = AlgoliaSearch(ALGOLIA_APP_ID, ALGOLIA_ADMIN_KEY);

return client.initIndex(indexName);
}

const params = {
"facets": [
"version",
],
"facetFilters": [
[
"_tags:version:5.4.0"
]
],
};

index = init('methods');

// index.search('', params).then((results) => {
// const {hits} = results;
// console.log(hits.length, results);
// }).catch(console.log);


index.deleteBy('', params).then((results) => {
const {hits} = results;
console.log(hits, results);
}).catch(console.log);