matchish / laravel-scout-elasticsearch

Search among multiple models with ElasticSearch and Laravel Scout
MIT License
711 stars 115 forks source link

[Feature] Implement createIndex method for engine #223

Open matchish opened 1 year ago

matchish commented 1 year ago

Laravel scout have scout:index command that not implemented here

Describe the solution you'd like Have to create index from index name and ignore index key. If there are settings and mappings for the index name they have to be applied. Otherwise default have to be applied

Context https://github.com/matchish/laravel-scout-elasticsearch/issues/46#issuecomment-1330485985

Take a look how to instantiate an index https://github.com/matchish/laravel-scout-elasticsearch/blob/e545cde6a5b0ca663562f388a57c79002d4a92d8/src/ElasticSearch/Index.php#L87 Here how to store the index https://github.com/matchish/laravel-scout-elasticsearch/blob/e545cde6a5b0ca663562f388a57c79002d4a92d8/src/Jobs/Stages/CreateWriteIndex.php#L36 Also consider to check by alias if the index exists already before create new one. If the index exists already the method have to fail.