Skip to content

Commit

Permalink
chore : update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hilsonxhero committed Feb 18, 2023
1 parent e5c0c23 commit 5522dd9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
21 changes: 16 additions & 5 deletions docs/commands.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,34 @@
# Console commands

## Create

Use Laravel Scout import command to create and update indices.

```
php artisan scout:import <model>
```
php artisan elastic:create

For example, if your model is "App\Models\Post.php" then command would be like this:

```php
php artisan scout:import "App\Models\Post.php"
```
Creates all indices.
Throws an exception if one already exists.

If you want to recreate an index, first make sure it's deleted and then create it.
Follow up with a scout import to refill the index as well.

## Delete

```
php artisan elastic:delete
php artisan scout:delete-index <model>
```
Deletes all indices.

Use Laravel Scount delete-index command to delete the indices.

## Search

```
php artisan elastic:search <model> <term> --fields=<fields>
```

Rudimentary command to test a basic search query.
2 changes: 1 addition & 1 deletion docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ After that, you can define your first index in config/elasticvision.php:
]
```

Upon saving the file, run `php artisan elastic:create` to create this index, and `php artisan scout:import "App\Models\Post"` to add your posts as documents to the index.
Upon saving the file, run `php artisan scout:import "App\Models\Post"` to add your posts as documents to the index.
This of course assumes that you have a Post model (with an ID and title attribute) and a couple of entries of them in your database.
As mentioned before, Laravel Scout also has a few requirements explained in its documentation for your models.

Expand Down

0 comments on commit 5522dd9

Please sign in to comment.