belongsToMany(Author::class, 'book_authors'); } public function location() { return $this->belongsTo(Location::class); } protected $mapping = [ 'properties' => [ 'name' => [ 'type' => 'text', // Also you can configure multi-fields, more details you can find here https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-fields.html 'fields' => [ 'raw' => [ 'type' => 'keyword', ] ] ], ] ]; }