- How do I perform zero-downtime index swaps in Laravel using this package?
- Use the `IndexManager::updateAlias()` method to atomically swap indices (e.g., `products_v1` to `products_v2`). This supports blue-green deployments and canary releases without disrupting search availability. Integrate it with Laravel’s deployment pipelines like Forge or Envoyer for automated swaps.
- Does this package support Laravel Scout for OpenSearch?
- No, this is a low-level adapter for raw OpenSearch operations. For Scout integration, you’d need to bridge it with Scout’s existing OpenSearch driver or build a custom wrapper. The package focuses on index/document management, not Laravel-specific search queries.
- What Laravel versions are officially supported?
- The package doesn’t enforce Laravel version constraints, but it requires PHP 8.1+ for type safety. Test thoroughly with your Laravel version (8.x–10.x) as the adapter is framework-agnostic. Check the [GitHub issues](https://github.com/DirectoryTree/OpenSearchAdapter/issues) for version-specific feedback.
- Can I use this for alias-based routing (e.g., directing traffic by user segment)?
- Basic alias swaps are supported, but advanced routing (e.g., `user_id`-based aliases) isn’t natively implemented. You’d need to extend the `IndexManager` or use OpenSearch’s native routing features alongside this adapter. Feature requests for routing are welcome on GitHub.
- How do I test atomic alias updates in a Laravel test suite?
- Mock the OpenSearch client using Laravel’s `Mockery` or `Pest` to simulate alias updates. Test edge cases like concurrent updates with `expectException()` or chaos testing libraries. For queue-based updates, use Laravel’s `Queue::fake()` to verify job execution.
- What happens if an alias swap fails mid-operation?
- The package doesn’t include built-in retry logic for failed swaps. Handle failures by wrapping `updateAlias()` in a transaction or retry loop (e.g., using Laravel’s `retry()` helper). Monitor OpenSearch logs for coordination errors during atomic operations.
- Are there performance benchmarks for alias swaps with large indices?
- No official benchmarks exist, but atomic swaps typically add minimal latency (sub-100ms for most cases). Test with your index size using `microtime()` around `updateAlias()` calls. For high-frequency updates, consider batching swaps or using queue workers.
- How does this compare to Laravel Scout’s OpenSearch driver?
- Scout’s driver abstracts search queries but lacks fine-grained index/alias control. This adapter gives you direct access to OpenSearch’s atomic alias features, ideal for production deployments. Use Scout for query simplicity and this package for infrastructure management.
- Can I version aliases (e.g., `v1`, `v2`, `v3`) for rollback safety?
- The package doesn’t enforce versioning, but you can manually manage aliases with suffixes (e.g., `products_v1`). Implement a custom `AliasManager` class to track versions and automate rollbacks via `IndexManager::updateAlias()` with conditional logic.
- What’s the maintenance status of this package?
- Development appears inactive post-release, with no recent commits. Mitigate risks by forking the repo to add retry logic or testing. Monitor GitHub issues for unresolved bugs. For critical projects, consider a custom wrapper or alternative like `ruflin/elastica` with OpenSearch support.