Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In WordPress Last updated: September 6, 2023
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

At Geekflare, I use Algolia for search, and while testing a few things around Polylang for translation, I noticed translated posts started appearing on the search results.

algolia-search-result-french

This was unpleasant, and we needed to find a way to delete these records from Algolia.

When I logged into the Algolia dashboard, I could see translated posts have taxonomies as Francais.

algolia-taxonomies

But there is no way to delete records from the dashboard. Algolia’s dashboard is minimal; they recommend using their API to manage the records.

After some research, I found a way to delete these entries. You can use cURL or an HTTP client like Postman.

You need the following details as a prerequisite:

  • Algolia application ID
  • Admin API key
  • Index name

The above details are under Settings >> API Keys on the Algolia dashboard.

First, let’s query to confirm you are getting expected records to ensure you don’t delete something else.

curl -X POST \
     -H "X-Algolia-API-Key: ADMIN_API_KEY" \
     -H "X-Algolia-Application-Id: APPLICATION_ID" \
     "https://APPLICATION_ID.algolia.net/1/indexes/INDEX_NAME/query" \
     --data '{"query": "", "filters": "taxonomies.language: Français"}'

Don’t forget to replace ADMIN_API_KEY, APPLICATION_ID, INDEX_NAME with your actual ones.

The above query was able to return the desired records. Now, I am confident to delete the records by using the below query.

curl -X POST \
     -H "X-Algolia-API-Key: ADMIN_API_KEY" \
     -H "X-Algolia-Application-Id: APPLICATION_ID" \
     "https://APPLICATION_ID.algolia.net/1/indexes/INDEX_NAME/deleteByQuery" \
     --data '{"query": "", "filters": "taxonomies.language: Français"}'

If you decide to use Postman, you can add the below headers.

  • X-Algolia-Application-Id
  • X-Algolia-API-Key
postman-algolia-headers

And, here is the successful results.

algolia-delete-records

My requirement was to delete taxonomies but through Algolia API you can manage pretty much everything. You can explore the official delete records API reference for more ideas.

  • Chandan Kumar
    Author
    As the founder of Geekflare, I’ve helped millions to excel in the digital realm. Passionate about technology, I’m on a mission to explore the world and amplify growth for professionals and businesses alike.
Thanks to our Sponsors
More great readings on WordPress
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • Monday.com is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder