Download the PHP package god-jay/scout-elasticsearch without Composer

On this page you can find all versions of the php package god-jay/scout-elasticsearch. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package scout-elasticsearch

god-jay scout-elasticsearch

Use elasticsearch as easy as using Eloquent ORM in your laravel application.

English | 简体中文

Contents

Installation

You can install the package via composer:

After installing the package, you should publish the Scout configuration using the vendor:publish Artisan command. This command will publish the scout.php configuration file to your config directory:

Then add

Docker compose run es + kibana

If you don't have your own es service, you may install and run es + kibana with docker compose:

in your .env file.

Configuration

Assuming there is a posts table and a Post Model, the simplified table may looks like:

id title content created_at
1 标题 文本内容 2020-01-01 01:01:01

Use GodJay\ScoutElasticsearch\Searchable in your model:

Add searchableAs function in the model:

Usage

Create elasticsearch index

Add getElasticMapping function in the model,

then run php artisan elastic:create-index "App\Models\Post"

For more details, see Create index API

The elasticsearch index will be like:

Import the given model into the search index

If there already exist many rows in your table, and you want to import the rows to elasticsearch,

Add toSearchableArray function in the model, then run php artisan scout:import "App\Models\Post"

After import the rows from table above, the elasticsearch index will be like:

Flush all of the model's records from the index

Run php artisan scout:flush "App\Models\Post"

Adding Records

Once you have added the Searchable trait to a model, all you need to do is save a model instance and it will automatically be added to your search index.

Updating Records

To update a searchable model, you only need to update the model instance's properties and save the model to your database.

Removing Records

To remove a record from your index, delete the model from the database. This form of removal is even compatible with soft deleted models:

Searching

Base:

Paginate:

Highlight:

The search result will be:

Advanced Usage

ES script sort:

Debug:

The result will be:

The json string of $debug['query_params'] will be:


All versions of scout-elasticsearch with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0
elasticsearch/elasticsearch Version ^7.7
laravel/scout Version ^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package god-jay/scout-elasticsearch contains the following files

Loading the files please wait ....