<img alt="search-tech" data- data-src="https://kirelos.com/wp-content/uploads/2023/09/echo/search-tech.jpg/w=800" data- decoding="async" height="420" src="data:image/svg xml,” width=”800″>

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.

<img alt="algolia-search-result-french" data- data-src="https://kirelos.com/wp-content/uploads/2023/09/echo/algolia-search-result-french.png/w=900" data- decoding="async" height="203" src="data:image/svg xml,” width=”900″>

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.

<img alt="algolia-taxonomies" data- data-src="https://kirelos.com/wp-content/uploads/2023/09/echo/algolia-taxonomies.png/w=900" data- decoding="async" height="629" src="data:image/svg xml,” width=”900″>

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
<img alt="postman-algolia-headers" data- data-src="https://kirelos.com/wp-content/uploads/2023/09/echo/postman-algolia-headers.png/w=800" data- decoding="async" height="112" src="data:image/svg xml,” width=”800″>

And, here is the successful results.

<img alt="algolia-delete-records" data- data-src="https://kirelos.com/wp-content/uploads/2023/09/echo/algolia-delete-records.png/w=800" data- decoding="async" height="492" src="data:image/svg xml,” width=”800″>

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.

  • 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.