i'm creating a Car Dealer web-site. And i'm trying to use elasticsearch for my search. But i dont understand relationships in elasticsearch. i have Cars
, Car_Options
, Brand
, City
tables. i'm keeping some meta-datas in Car_Options
table. normally in mysql my tables like :
Car Table :
id , name , brand_id , price , city_id
Car_Options Table :
id , car_id , name , value
Brand Table :
id , name
City Table :
id , name
i tried to use this package for elasticsearch : iverberk/larasearch. I can index my Cars table (Model) and i can search on this table. But i could not understand how to fetch related datas from other tables. i read about relations on elasticsearch , but i could not implement it. Some of them tells about indexing them to one document. some of them tells about parent/child way. So , my problem is , i dont understand how to index relations on elastic search and how to search them.
i indexed Cars and Cites to try but i could not get to true result. i made some tries like :
return Car::search('NewYork', ['fields' => ['city.name']])->getResults();
Waiting for help about logic ! which way i should follow ? how should i index them with relations ?
Thank you !