scout:sync-index-settings
Sync your configured index settings with your search engine (Meilisearch).
Synopsis
Description
This command synchronizes the index configuration defined in your Laravel Scout models with Meilisearch. It updates:
Searchable attributes
Filterable attributes
Sortable attributes
Ranking rules
Stop words
Synonyms
Typo tolerance settings
Use this command after modifying search configuration in your models to apply the changes to Meilisearch.
Usage Examples
Basic Usage
Sync all index settings:
Output:
DDEV Environment
Run in DDEV:
When to Use
Required Scenarios
Use scout:sync-index-settings when you:
Modify Searchable Fields: Change which fields are searchable
Update Filterable Fields: Add or remove filterable attributes
Change Sortable Fields: Modify which fields can be sorted
Adjust Ranking Rules: Update search result ranking
Configure Stop Words: Add or remove stop words
Update Synonyms: Modify synonym lists
Change Typo Tolerance: Adjust typo tolerance settings
After Model Changes
After modifying the toSearchableArray() method or Scout configuration in models:
Configuration
Model Configuration
Index settings are defined in Scout models using the searchableAs() and configuration methods:
Meilisearch Settings
Configure Meilisearch-specific settings in config/scout.php:
What It Syncs
Searchable Attributes
Fields that can be searched:
Filterable Attributes
Fields that can be used in filters:
Sortable Attributes
Fields that can be used for sorting:
Ranking Rules
Order of ranking criteria:
Performance Impact
Sync Time
Small indexes (< 1,000 docs): < 1 second
Medium indexes (1,000-100,000 docs): 1-5 seconds
Large indexes (> 100,000 docs): 5-30 seconds
No Reindexing
This command only updates settings, not data. It does not trigger reindexing.
Zero Downtime
Settings are updated without downtime. Search continues to work during sync.
Verification
Check Settings Applied
Verify settings in Meilisearch:
Test Filters
Verify filterable attributes work:
Test Sorting
Verify sortable attributes work:
Troubleshooting
Settings Not Applied
Problem: Settings don't seem to apply
Solutions:
Check Meilisearch is running
Verify configuration in
config/scout.phpClear config cache:
php artisan config:clearCheck Meilisearch logs for errors
Manually verify settings via API
Filter Not Working
Problem: Cannot filter by a field
Solutions:
Ensure field is in
filterableAttributesRun
scout:sync-index-settingsVerify field exists in
toSearchableArray()Check field data type matches filter
Sort Not Working
Problem: Cannot sort by a field
Solutions:
Ensure field is in
sortableAttributesRun
scout:sync-index-settingsVerify field exists in
toSearchableArray()Check field contains sortable data
Connection Error
Problem: Cannot connect to Meilisearch
Solutions:
Check Meilisearch is running:
ddev describeVerify
MEILISEARCH_HOSTin.envCheck network connectivity
Restart Meilisearch:
ddev restart
Best Practices
After Config Changes: Always run after modifying search configuration
Version Control: Track configuration changes in git
Test Thoroughly: Verify filters and sorting work after sync
Document Changes: Note what settings were changed and why
Staging First: Test on staging before production
Common Scenarios
Adding a New Filterable Field
Add field to model's
toSearchableArray()Add field to
filterableAttributesin configRun
scout:sync-index-settingsTest filtering works
Changing Ranking Rules
Modify
rankingRulesin configRun
scout:sync-index-settingsTest search result ordering
Adding Synonyms
Add synonyms to config
Run
scout:sync-index-settingsTest synonym search works
Related Commands
meilisearch:setup - Initial Meilisearch setup
meilisearch:reindex - Reindex content