Closed stevebauman closed 3 weeks ago
I certainly don't want PHP dropping all of my indices - I'm glad to keep that protection. Using 'elastic:migrate:refresh' is what I want to use most of the time.
@ElvisIsKing666 this command is intentionally destructive and behaves exactly like the php artisan migrate:fresh
command. Don't run it if you don't all your indicies dropped.
Thanks @stevebauman - what I meant was that when I run artisan migrate:fresh
it doesn't try to drop all the DB's in my local mysql - just the one it manages. But I am assuming that the error for using '*' wildcards is letting me know that this module is trying to drop more than just the single index that is currently managed. I have not dug into the code to see how it's running the index deletion - but wildcards sound bad.
An index is the equivalent to a DB table:
artisan migrate:fresh
drops all DB tablesartisan elastic:migrate:fresh
drops all indexesInteresting - I hadn't seen the analogy. I was thinking of elasticsearch as the DB engine - not as a single DB. I don't know much about elasticsearch yet - I've only really just started - so then it would be wise for me to partition my other indices - like APM and Logstash so that something like migrate:fresh
can't affect them. I've not looked at how things are partitioned.
Hi there, I think this has been raised before :)
The main use case for php artisan elastic:migrate:fresh
is to drop everything when running tests and it's okay to set action.destructive_requires_name = false
on test environments. This is even mentioned in README:
Note that this command uses wildcards to delete indices. This requires setting action.destructive_requires_name to false.
If you want to be safe or don't want to tweak index settings, you can always use elastic:migrate:refresh
, which rolls back all migrations and then runs them again.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days
Describe the bug
Running
php artisan elastic:migrate:fresh
fails due to wildcard drops being disabled for safety by default in Elasticsearch 8.0:https://www.elastic.co/guide/en/elasticsearch/reference/current/index-management-settings.html#action-destructive-requires-name
This protection can be disabled via the below:
Though I think we can just update the command to loop through each index and delete them by name.
To Reproduce