Closed LordVersA closed 2 years ago
It's not the package specific. You have to learn elasticsearch if you want to know how to config it If you know what you need just put it to config file. Here is an example https://github.com/matchish/laravel-scout-elasticsearch/blob/php8/config/elasticsearch.php
I want two separated project use one dedicated server for search engine and now I don't know what should I do? how can I install 2 elastic search in one server?
or should I use prefix for separating 2 project?
scout.prefix
in config should solve your issue
I used it but my scout search between all indexes my search query is:
$result = Mixed::search('',function ($client,$body) use ($q){
return $client->search([
'body' => [
"query" => [
"query_string" => [
"query" => $q ,
"fields" => [
"title_fa" ,
"title_en" ,
] ,
"fuzziness" => "AUTO" ,
] ,
] ,
],
//"_source" => [
// "id" ,
//] ,
"from" =>0,
"size" => 100 ,
]);
}
)->within(implode(',', [
(new Series())->searchableAs(),
(new Movie())->searchableAs(),
]))->raw();
how can I use this query to specify that search just work in Series and Movies indexes?
An example of an search with explicit index $client->search(['index' => 'products', 'body' => $body->toArray()]);
I want to search in 2 indexes at the same time, how can I change this code to specify this for searing in 2 indexes?
I fix my problem with index parameter thanks
$result = Mixed::search('',function ($client,$body) use ($q){
return $client->search([
"index" => ["prefix_movies","prefix_series"],
'body' => [
"query" => [
"query_string" => [
"query" => $q ,
"fields" => [
"fa_title" ,
"en_title" ,
] ,
"fuzziness" => "AUTO" ,
] ,
] ,
] ,
//"_source" => [
// "id" ,
//] ,
"from" => 0 ,
"size" => 100 ,
]);
}
)->within(implode(',', [
(new Series())->searchableAs(),
(new Movie())->searchableAs(),
]))->get();
Describe the solution you'd like I want a clear document for config file, and how can I customize configuration for indexing, settings and etc.