laravelalgoliasearchablelaravel-scout

Laravel scout Algolia Is there anyway to remove an item from the search index without removing it from the local db


I know that I can remove an item from the search index by:

$order = App\Order::find(1);
$order->delete();

or

App\Order::where('price', '>', 100)->unsearchable();

But I only want to remove it from the search index/Algolia and still keep it in my local DB, is this possible?


Solution

  • Your second snippet is correct, unsearchable will remove the record from Algolia but keep it in your local DB.

    App\Order::find(1)->unsearchable();