babenkoivan / elastic-scout-driver-plus

Extension for Elastic Scout Driver
MIT License
267 stars 52 forks source link

search email [Help] #73

Closed rolandverner closed 3 years ago

rolandverner commented 3 years ago

Sorry, I can't find any information about it maybe somebody can help.

    $search = User::boolsearch();
        $search->should((new MatchQueryBuilder())->field('email')->query($this->search)->fuzziness('AUTO'));
        $search->minimumShouldMatch(1);
        $search->withTrashed();
    $users = $search->paginate($this->pagination);
    $users->setCollection($users->models());

it's not searching without I not write a full email


And another question how to use eloquent with eslaticsearch?

        $users = User::query();
        $users->accountVerified();
        $users->registered();

        $users->boolsearch();
        $search->should((new MatchQueryBuilder())->field('email')->query($this->search)->fuzziness('AUTO'));
        $search->minimumShouldMatch(1);
        $search->withTrashed();
babenkoivan commented 3 years ago

it's not searching without I not write a full email

Please check your mapping, not all types allow partial search.

And another question how to use eloquent with eslaticsearch?

The driver searches data in Elasticsearch, then finds the respective models in the database using primary keys. This is how Scout works in general. If you need to refine the search results, it's better to add a filter in the search request itself.

babenkoivan commented 3 years ago

Closing as it's not a bug or a feature request.