spatie/elasticsearch-query-builder
Lightweight fluent PHP query builder for Elasticsearch. Build and execute searches with an ergonomic Builder API: set index, add queries, aggregations, sorting, and filters, then run search() against the official Elasticsearch PHP client.
Model::query()).bool, match, range) and aggregations (e.g., max, avg), enabling complex search logic without manual DSL construction.elasticsearch-search-string-parser, suggesting strong use cases for full-text search with query parsing (e.g., faceted search, autocomplete).elasticsearch/elasticsearch PHP client (v8+), which is a standard dependency for Elasticsearch in Laravel. No conflicting dependencies.Mockery for Elasticsearch client mocking).elasticsearch/elasticsearch PHP client, which is already a dependency in many Laravel Elasticsearch setups.BoolQuery in a SearchService with the builder’s fluent equivalent.elasticsearch/elasticsearch PHP client is pinned to a compatible version (e.g., ^8.0).keyword vs. text fields).// app/Providers/ElasticsearchServiceProvider.php
Builder::macro('customQuery', function () { ... });
search method or standalone indices.composer require spatie/elasticsearch-query-builder.config/services.php or a dedicated config file.MatchQuery, TermQuery) in repositories/services.MaxAggregation, TermsAggregation) for analytics.debugbar or custom logging).spatie/elasticsearch-query-builder and elasticsearch/elasticsearch. Minor updates likely safe; major updates may require testing.ruflin/elastica).dd($builder->getQuery())) for debugging.should/must clauses).retry helper) and circuit breakers.search with hits or source filtering.search_after for pagination._validate/query API or tests.match vs. term).GeoDistanceQuery").How can I help you explore Laravel packages today?