This release is compatible with Laravel 10, 11 & 12
New Feature: Query String Queries
This release introduces Query String Queries, bringing full Elasticsearch query_string syntax support directly into your Eloquent-style queries.
- Method:
searchQueryString(query, $fields = null, $options = [])and related methods (orSearchQueryString,searchNotQueryString, etc.) - Supports all
query_stringfeatures — logical operators, wildcards, fuzziness, ranges, regex, boosting, field scoping, and more - Includes a dedicated
QueryStringOptionsclass for fluent option configuration or array-based parameters - See Tests
- Full documentation
Example:
Product::searchQueryString('status:(active OR pending) name:(full text search)^2')->get();
Product::searchQueryString('price:[5 TO 19}')->get();
// vanilla optional, +pizza required, -ice forbidden
Product::searchQueryString('vanilla +pizza -ice', function (QueryStringOptions $options) {
$options->type('cross_fields')->fuzziness(2);
})->get();
//etcOrdering enhancement: unmapped_type
- You can now add an
unmapped_typeflag to your ordering query #88
Product::query()->orderBy('name', 'desc', ['unmapped_type' => 'keyword'])->get();Bugfix
- Fixed issue where limit values were being reset on bucket aggregations #84
Full Changelog: v5.1.0...v5.2.0