Searchkick manually remove specific record Index Searchkick manually remove specific record Index elasticsearch elasticsearch

Searchkick manually remove specific record Index


If anyone's looking for how to delete & blow away the entire index to start off fresh you can do it as so:

MyModel.searchkick_index.delete &&  MyModel.searchkick_index.create


To remove from index:

product = Product.find 10Product.searchkick_index.remove(product)


Given product = Product.find(10).

If product.should_index? returns false, product.reindex will remove that record from the index.

If you need to manually remove a record though, Product.searchkick_index.remove(product) is the way to go.