0

I have a Laravel application. I installed elasticsearch server and implemented it to laravel using scout and tamayo/laravel-scout-elastic.

All is working almost perfectly. I have two questions that I can't find the answer to.

  1. How to order the output of the results by most words matching. Or _score of the elastic results

  2. How to combine two types of the same index? I have index by the name of news how to combine world news and sports news?

I am using this method to make the search:

$searched = Model::search($q)->get();

In the model I've included the Scout

use Laravel\Scout\Searchable; and use Searchable;

Don40
  • 373
  • 3
  • 17

1 Answers1

0
  1. You can pass callback to search method and customize request https://laravel.com/docs/master/scout#customizing-engine-searches

  2. There is no way to do it with tamayo/laravel-scout-elastic but you can do it with https://github.com/matchish/laravel-scout-elasticsearch if you ready to move types in separated indices. In Elasticsearch 7 mapping types have been removed so I recommend do it anyway.

Serhii Shliakhov
  • 2,631
  • 3
  • 19
  • 37