Saves multiple properties in the same index Elasticsearch with Laravel

Viewed 59

when I want to save multiple properties in the same index, I get this error

Rejecting mapping update to [general] as the final mapping would have more than 1 type: [rooms, properties]

This way I save the data

try
        {
            $this->selectRoomTable()->chunk(5000, function ($rows) {
                $rows->addToindex();
            });

            $this->selectPropertyTable()->chunk(5000, function ($rows) {
                dd($rows->addToindex());
            });

            $this->selectWantedTable()->chunk(5000, function ($rows) {
                $rows->addToindex();
            });
            
            // Index progress report
            $console->writeln("Indexed {$totalRows} rows");
            return "success";
        }
        catch(\Exception $e)
        {
            return $e->getMessage();
        }

And that's what a model looks like

private function selectRoomTable()
    {
        $table = Room::select('post_code', 'id');

        return $table;
    }

And the general index is called that

'default_index' => 'general',

I use https://github.com/elasticquent/Elasticquent So my final question is, how can I add more properties to the same (general) index

0 Answers
Related