B
B
BarneyGumble2021-06-04 15:54:21
css
BarneyGumble, 2021-06-04 15:54:21

How to feed data from linked table to Elasticsearch?

There is a site with the Laravel Scout Elasticsearch Driver
installed. The data itself in Scout is imported from the App\Models\Hotel model via php artisan scout:import "App\Models\Hotel"
Model content:

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Laravel\Scout\Searchable;

class Hotel extends Model
{
    use HasFactory;
    use Searchable;
  
    public $fillable = ["name", "address"];

    public function hotels_images()
    {
        return $this->hasMany('App\Models\Image');
    }
}

Those. the search is now going on the name and address fields , everything is fine

But I also need to search on the hotel description field, but it lies in a separate table linked to the main table hotels by hotel_id :
KAxolZJfZGDdV2.jpg

in Elasticsearch there is also a description, so that the search occurs according to the description?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RAX7, 2019-02-16
@a1max

y .container-fluid.adblockstands overflow: hidden;so everything that goes beyond this block is cut off.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question