Open Pashaster12 opened 7 years ago
You should use type in your index. Each index can have many type.
@thaoha As for ElasticQuent docs, Eloquent Model may have one type too, which set with GetTypeName:
function getTypeName() { return 'custom_type_name'; }
As you see, there isn't an array in the returned value... So, how can I set different types for one Eloquent Model - the problem is the same as with several indexes for one model.
Very easy @Pashaster12. With one table you can create many Model so with each model you can set with different type.
@thaoha Yeah, I understand this. But I don't like this way, because I should create a lot of fake models for additional indexes.
Yeah, but personally I think you should create model for each type because it make your structure more clearly and you can have few logic for each type as you want.
Types are being removed, see: https://www.elastic.co/guide/en/elasticsearch/reference/6.x/removal-of-types.html
Is it possible to make two and many indexes for the one model? For example, I have the DB's table called 'users' where I store information about users with different roles (role_id). And I want to create different indexes for each user role (teachers, students, etc.). But the problem is I have one Laravel Eloquent Model for the table 'users'. What the best way for solution this problem? Make one index with unions different roles or make several indexes for each users' category? Thanks for reply.