Difference in number of indexed records

I’m using Laravel and Scout.
When I import my records to Algolia via command line, I can see all 23,000 records are being imported flawlessly.
But when I check the dashboard it says there are only 19,000 records in my index.
Am I missing something here?
Thank you,

p.s. this is the command which works with no problem:
php artisan scout:import “some_model”

Hi Sohail,

I think Laravel Scout is only giving the highest ID (primary key) of the imported data. It’s not a count.
Is it possible that you have 19 000 entries and the latest ID is 23000?

It could happen if you deleted data (or even soft-deleted).

Hello Julien,
Thank you for your response.
Good point. I checked the db to find out if that is the case:

$ mysql> select count() from listing;
| count(
) |
| 23530 |
1 row in set (0.09 sec)

Unfortunately it wasn’t (however there were some records deleted and the last id is 26,500) but in Algolia dashboard number of records are 19,394.

I tested a few other models and they are all fine. It is just this particular table.
Most likely there is an issue in my records. I will go a bit deeper and let you know if I found anything.

1 Like