mgsmus Bende employee tablosundaki tum verileri index i mevcut elastic searchde .
ben simdi 2 ci bir index olusturmak istiyorum ama olmadi.ayni index i degistirdi yine employee isminde.
istediigim sonucuda alamadim.
$result = Employee::with('employeeData')->select('*','employeeData.avg_salary');
foreach ($result->cursor() as $employee)
{
$this->elasticsearch->index([
'index' => $employee->getSearchIndex(),
'type' => $employee->getSearchType(),
'id' => $employee->getKey(),
'body' => $employee->toSearchArray(),
]);
// PHPUnit-style feedback
$this->output->write('.');
}
$this->info("\nDone!");
soyle bir commandla indexleri olusturuyorum.
public function employeeData()
{
return $this->belongsTo(Employee::class, 'position_code', 'position_code')
->selectRaw('avg(wage) AS avg_salary')
->groupBy('position_code');
}
employee modelide su sekilde az onceki join icin. ama elastic searchde dogru sonuc alamadim.average_wage i alamadim