Level 16
Perhaps you should provide more information because your description is too vague.
Are you using Scout and an Elastic Search driver? If yes, which one? What are your mappings in the index? etc. etc.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have search form in laravel project that uses search with laravel eloquent query. I am trying to build more advanced search using elasticsearch, but I am new to this and I need help to transform this query to elasticsearch query. Any help is appreciated. Here is my query.
$query = Property::query();
if (Request::has('propertyType')) {
Request::get('propertyType');
}
$propertyType = Request::input('propertyType');
if (!empty($propertyType)) {
$query->whereHas('category', function ($query) use ($propertyType) {
$query->whereIn('category', $propertyType);
});
}
$results = $query->paginate(6, ['*'], 'searchResults');
Please or to participate in this conversation.