scout: scout:flush command doesn't flush/remove anything?
It seems scout:flush
doesn’t seem to do anything. Deleting a record from the database manually then doing scout:flush
and/or scout:import
doesn’t remove the old record.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 7
- Comments: 17 (5 by maintainers)
The
scout:flush
command doesn’t clear the index but instead, it removes items by ID.Is it possible that the id you have in database are not the same as the one you have in your search index?
This happens when you seed your DB, import, trunctate your table and seed again. At this point, if you flush, it won’t remove anything.
If we want to do it right, it implies to add a public
clear()
method in each engine implementation, so adding it to the abstract class but it would break backward compatibility.But you can define your own, I just made one for Algolia: https://gist.github.com/julienbourdeau/c5b3adc369da2e5e02527de3cb73ee6c
Yup - that’s exactly the case, as reported by OP; it “works”, but you’d expect flush to empty all entries, as after truncating the DB it won’t be possible to get rid of them without resorting to deleting the index file.
I can confirm this, doing flush with ElasticSearch doesn’t work.
So is there a possibility of having a command created or changed so it can clear all regardless of id
On my fresh install of 5.4 while flush removes entries that exist, it doesn’t remove entries that do not