Plastic is an Elasticsearch ODM and mapper for Laravel. It renders the developer experience more enjoyable while using Elasticsearch, by providing a fluent syntax for mapping, querying, and storing eloquent models.

Overview

Plastic Logo

Plastic is an Elasticsearch ODM and mapper for Laravel. It renders the developer experience more enjoyable while using Elasticsearch, by providing a fluent syntax for mapping, querying, and storing eloquent models.

License Build Status StyleCI

This package is still under active development and may change.

For Elasticsearch v2 please refer to version < 0.4.0.

Installing Plastic

composer require sleimanx2/plastic

If you are using Laravel >=5.5 the service provider will be automatically discovered otherwise we need to add the plastic service provider to config/app.php under the providers key:

Sleimanx2\Plastic\PlasticServiceProvider::class

Finally we need to run:

php artisan vendor:publish

This will create a config file at config/plastic.php and a mapping directory at database/mappings.

Usage

Defining Searchable Models

To get started, enable searching capabilities in your model by adding the Sleimanx2\Plastic\Searchable trait:

use Sleimanx2\Plastic\Searchable;

class Book extends Model
{
    use Searchable;
}

Defining what data to store.

By default, Plastic will store all visible properties of your model, using $model->toArray().

In addition, Plastic provides you with two ways to manually specify which attributes/relations should be stored in Elasticsearch.

1 - Providing a searchable property to our model

public $searchable = ['id', 'name', 'body', 'tags', 'images'];

2 - Providing a buildDocument method

public function buildDocument()
{
    return [
        'id' => $this->id,
        'tags' => $this->tags
    ];
}

Custom elastic type name

By the default Plastic will use the model table name as the model type. You can customize it by adding a $documentType property to your model:

public $documentType = 'custom_type';

Custom elastic index name

By the default Plastic will use the index defined in the configuration file. You can customize in which index your model data will be stored by setting the $documentIndex property to your model:

public $documentIndex = 'custom_index';

Storing Model Content

Plastic automatically syncs model data with elastic when you save or delete your model from our SQL DB, however this feature can be disabled by adding public $syncDocument = false to your model.

Its important to note that manual document update should be performed in multiple scenarios:

1 - When you perform a bulk update or delete, no Eloquent event is triggered, therefore the document data won't be synced.

2 - Plastic doesn't listen to related models events (yet), so when you update a related model's content you should consider updating the parent document.

Saving a document

$book = Book::first()->document()->save();

Partial updating a document

$book = Book::first()->document()->update();

Deleting a document

$book = Book::first()->document()->delete();

Saving documents in bulk

Plastic::persist()->bulkSave(Tag::find(1)->books);

Deleting documents in bulk

$authors = Author::where('age','>',25)->get();

Plastic::persist()->bulkDelete($authors);

Searching Model Content

Plastic provides a fluent syntax to query Elasticsearch which leads to compact readable code. Lets dig into it:

$result = Book::search()->match('title','pulp')->get();

// Returns a collection of Book Models
$books = $result->hits();

// Returns the total number of matched documents
$result->totalHits();

// Returns the highest query score
$result->maxScore();

//Returns the time needed to execute the query
$result->took();

To get the raw DSL query that will be executed you can call toDSL():

$dsl = Book::search()->match('title','pulp')->toDSL();

Pagination

$books = Book::search()
    ->multiMatch(['title', 'description'], 'ham on rye', ['fuzziness' => 'AUTO'])
    ->sortBy('date')
    ->paginate();

You can still access the result object after pagination using the result method:

$books->result();

Bool Query

User::search()
    ->must()
        ->term('name','kimchy')
    ->mustNot()
        ->range('age',['from'=>10,'to'=>20])
    ->should()
        ->match('bio','developer')
        ->match('bio','elastic')
    ->filter()
        ->term('tag','tech')
    ->get();

Nested Query

$contain = 'foo';

Post::search()
    ->multiMatch(['title', 'body'], $contain)
    ->nested('tags', function (SearchBuilder $builder) use ($contain) {
        $builder->match('tags.name', $contain);
    })->get();

Check out this documentation of supported search queries within Plastic and how to apply unsupported queries.

Change index on the fly

To switch to a different index for a single query, simply use the index method.

$result = Book::search()->index('special-books')->match('title','pulp')->get();

Aggregation

$result = User::search()
    ->match('bio', 'elastic')
    ->aggregate(function (AggregationBuilder $builder) {
        $builder->average('average_age', 'age');
    })->get();

$aggregations = $result->aggregations();

Check out this documentation of supported aggregations within plastic and how to apply unsupported aggregations.

Suggestions

Plastic::suggest()->completion('tag_suggest', 'photo')->get();

The suggestions query builder can also be accessed directly from the model as well:

//this be handy if you have a custom index for your model
Tag::suggest()->term('tag_term','admin')->get();

Model Mapping

Mappings are an important aspect of Elasticsearch. You can compare them to indexing in SQL databases. Mapping your models yields better and more efficient search results, and allows us to use some special query functions like nested fields and suggestions.

Generate a Model Mapping

php artisan make:mapping "App\User"

The new mapping will be placed in your database/mappings directory.

Mapping Structure

A mapping class contains a single method map. The map method is used to map the given model fields.

Within the map method you may use the Plastic Map builder to expressively create field maps. For example, let's look at a sample mapping that creates a Tag model map:

use Sleimanx2\Plastic\Map\Blueprint;
use Sleimanx2\Plastic\Mappings\Mapping;

class AppTag extends Mapping
{
    /**
     * Full name of the model that should be mapped
     *
     * @var string
     */
    protected $model = App\Tag::class;

    /**
     * Run the mapping.
     *
     * @return void
     */
    public function map()
    {
        Map::create($this->getModelType(), function (Blueprint $map) {
            $map->string('name')->store('true')->index('analyzed');

            // instead of the fluent syntax we can use the second method argument to fill the attributes
            $map->completion('suggestion', ['analyzer' => 'simple', 'search_analyzer' => 'simple']);
        },$this->getModelIndex());
    }
}

To learn about all of the methods available on the Map builder, check out this documentation.

Run Mappings

Running the created mappings can be done using the Artisan console command:

php artisan mapping:run

Updating Mappings

If your update consists only of adding a new field mapping you can always update our model map with your new field and run:

php artisan mapping:rerun

The mapping for existing fields cannot be updated or deleted, so you'll need to use one of following techniques to update existing fields.

1 - Create a new index

You can always create a new Elasticsearch index and re-run the mappings. After running the mappings you can use the bulkSave method to sync your SQL data with Elasticsearch.

2 - Using aliases

Its recommended to create your Elasticsearch index with an alias to ease the process of updating your model mappings with zero downtime. To learn more check out:

https://www.elastic.co/blog/changing-mapping-with-zero-downtime

Populate An Index

Populating an index with searchable models can be done by running an Artisan console command :

php artisan plastic:populate [--mappings][--index=...][--database=...]
  • --mappings Create the models mappings before populating the index
  • --database=... Database connection to use for mappings instead of the default one
  • --index=... Index to populate instead of the default one

The list of models from which to recreate the documents has to be configured per index in config/plastic.php:

    'populate' => [
        'models' => [
            // Models for the default index
            env('PLASTIC_INDEX', 'plastic') => [
                App\Models\Article::class,
                App\Models\Page::class,
            ],
            // Models for the index "another_index"
            'another_index' => [
                App\Models\User::class,
            ],
        ],
    ],

Access The Client

You can access the Elasticsearch client to manage your indices and aliases as follows:

$client = Plastic::getClient();

//index delete
$client->indices()->delete(['index'=> Plastic::getDefaultIndex()]);
//index create
$client->indices()->create(['index' => Plastic::getDefaultIndex()]);

More about the official elastic client : https://github.com/elastic/elasticsearch-php

Contributing

Thank you for contributing, The contribution guide can be found Here.

License

Plastic is open-sourced software licensed under the MIT license.

To Do

Search Query Builder

  • implement Boosting query
  • implement ConstantScore query
  • implement DisMaxQuery query
  • implement MoreLikeThis query (with raw eloquent models)
  • implement GeoShape query

Aggregation Query Builder

  • implement Nested aggregation
  • implement ExtendedStats aggregation
  • implement TopHits aggregation

Mapping

  • Find a seamless way to update field mappings with zero downtime with aliases

General

  • Better query builder documentation
Comments
  • ES 5.1?

    ES 5.1?

    Seeing as how this is still under active development, have you thought about making sure this is built against the latest ES 5.1?

    Upgrading composer.json to the following:

    "elasticsearch/elasticsearch": "~5.1",
    "ongr/elasticsearch-dsl": "dev-master"
    

    Then running your unit tests results in a full pass. I know you probably don't want dev-master as dependency right now. But being under active development can't hurt to do so seeing as how ongr/elasticsearch-dsl is actively working on releasing their 5.x support.

    $ vendor/bin/phpunit
    PHPUnit 4.8.31 by Sebastian Bergmann and contributors.
    
    Runtime:	PHP 7.0.14 with Xdebug 2.5.0
    Configuration:	/Users/andrew/Developer/GitHub/ellisio/plastic/phpunit.xml
    
    ...............................................................  63 / 141 ( 44%)
    ............................................................... 126 / 141 ( 89%)
    ...............
    
    Time: 2.72 seconds, Memory: 18.00MB
    
    OK (141 tests, 246 assertions)
    
    Generating code coverage report in Clover XML format ... done
    
    Generating code coverage report in HTML format ... done
    
    next 
    opened by ellisio 13
  • Trait creation event throws

    Trait creation event throws "invalid request body provided" InvalidArgumentException from Guzzle

    ERROR: exception 'InvalidArgumentException' with message 'Invalid request body provided' in _{project path}_vendor/guzzlehttp/ringphp/src/Client/CurlFactory.php:289 Stack trace: #0 _{project path}_vendor/guzzlehttp/ringphp/src/Client/CurlFactory.php(248): GuzzleHttp\Ring\Client\CurlFactory->addStreamingBody(Array, Array) #1 _{project path}_vendor/guzzlehttp/ringphp/src/Client/CurlFactory.php(203): GuzzleHttp\Ring\Client\CurlFactory->applyBody(Array, Array) #2 _{project path}_vendor/guzzlehttp/ringphp/src/Client/CurlFactory.php(30): GuzzleHttp\Ring\Client\CurlFactory->applyMethod(Array, Array) #3 _{project path}_vendor/guzzlehttp/ringphp/src/Client/CurlHandler.php(84): GuzzleHttp\Ring\Client\CurlFactory->__invoke(Array, Resource id #920) #4 _{project path}_vendor/guzzlehttp/ringphp/src/Client/CurlHandler.php(68): GuzzleHttp\Ring\Client\CurlHandler->_invokeAsArray(Array) #5 _{project path}_vendor/guzzlehttp/ringphp/src/Client/Middleware.php(30): GuzzleHttp\Ring\Client\CurlHandler->__invoke(Array) #6 _{project path}_vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(184): GuzzleHttp\Ring\Client\Middleware::GuzzleHttp\Ring\Client{closure}(Array) #7 _{project path}_vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(159): Elasticsearch\Connections\Connection->Elasticsearch\Connections{closure}(Array, Object(Elasticsearch\Connections\Connection), Object(Elasticsearch\Transport), Array) #8 _{project path}_vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php(106): Elasticsearch\Connections\Connection->performRequest('PUT', '/plastic/descri...', Array, Array, Array, Object(Elasticsearch\Transport)) #9 _{project path}_vendor/elasticsearch/elasticsearch/src/Elasticsearch/Endpoints/AbstractEndpoint.php(80): Elasticsearch\Transport->performRequest('PUT', '/plastic/descri...', Array, Array, Array) #10 _{project path}_vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php(911): Elasticsearch\Endpoints\AbstractEndpoint->performRequest() #11 _{project path}_vendor/sleimanx2/plastic/src/Connection.php(148): Elasticsearch\Client->index(Array) #12 _{project path}_vendor/sleimanx2/plastic/src/Persistence/EloquentPersistence.php(27): Sleimanx2\Plastic\Connection->indexStatement(Array) #13 _{project path}_vendor/sleimanx2/plastic/src/Searchable.php(40): Sleimanx2\Plastic\Persistence\EloquentPersistence->save() #14 [internal function]: App\Description::Sleimanx2\Plastic{closure}(Object(App\Description)) #15 _{project path}_vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(221): call_user_func_array(Object(Closure), Array) #16 _{project path}_vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1679): Illuminate\Events\Dispatcher->fire('eloquent.saved:...', Object(App\Description)) #17 _{project path}_vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1514): Illuminate\Database\Eloquent\Model->fireModelEvent('saved', false) #18 _{project path}_vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1485): Illuminate\Database\Eloquent\Model->finishSave(Array) #19 _{project path}_vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php(187): Illuminate\Database\Eloquent\Model->save() #20 _{project path}_database/seeds/RuleTableSeeder.php(139): Illuminate\Database\Eloquent\Relations\MorphOneOrMany->create(Array) #21 _{project path}_vendor/laravel/framework/src/Illuminate/Database/Seeder.php(39): App\Database\Seeds\RuleTableSeeder->run() #22 _{project path}_database/seeds/RulesAndSkillsSeeder.php(18): Illuminate\Database\Seeder->call('App\Database\Se...') #23 _{project path}_vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php(63): RulesAndSkillsSeeder->run() #24 _{project path}_vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(2286): Illuminate\Database\Console\Seeds\SeedCommand->Illuminate\Database\Console\Seeds{closure}() #25 _{project path}_vendor/laravel/framework/src/Illuminate/Database/Console/Seeds/SeedCommand.php(64): Illuminate\Database\Eloquent\Model::unguarded(Object(Closure)) #26 [internal function]: Illuminate\Database\Console\Seeds\SeedCommand->fire() #27 _{project path}_vendor/laravel/framework/src/Illuminate/Container/Container.php(507): call_user_func_array(Array, Array) #28 _{project path}_vendor/laravel/framework/src/Illuminate/Console/Command.php(169): Illuminate\Container\Container->call(Array) #29 _{project path}_vendor/symfony/console/Command/Command.php(256): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #30 _{project path}_vendor/laravel/framework/src/Illuminate/Console/Command.php(155): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #31 _{project path}_vendor/symfony/console/Application.php(791): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #32 _{project path}_vendor/symfony/console/Application.php(186): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Database\Console\Seeds\SeedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #33 _{project path}_vendor/symfony/console/Application.php(117): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #34 _{project path}_vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #35 _{project path}_artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #36 {main} [] []

    opened by ghost 11
  • Console command to populate an index

    Console command to populate an index

    Hello,

    As proposed in #115 here is the command that populates an existing index.


    Usage

    php artisan plastic:populate [--mappings][--index=...][--database=...]
    
    • --mappings Create the models mappings before populating the index
    • --database=... Database connection to use for mappings instead of the default one
    • --index=... Index to populate instead of the default one

    I added the database option only so that it can be forwarded to the mapping command, but I don't use it for the models as each of them may use its own database connection.


    Configuration

    The list of models from which to recreate the documents has to be configured per index in config/plastic.php:

        'populate' => [
            'models' => [
                env('PLASTIC_INDEX', 'plastic') => [
                    App\Models\Article::class,
                    App\Models\Page::class,
                ],
                'another_index' => [
                    App\Models\User::class,
                ],
            ],
        ],
    

    I tested the command on Laravel 5.4 and ElasticSearch 5.2.2 by indexing 70k documents (size ~20MB)

    I spent quite a bit of time trying to add some automated tests but I didn't succeed as I use facades and config, without a package like orchestral/testbench this seems very hard to achieve. The only thing I can test for now is the existence of the command, would that be enough ?

    opened by shaoshiva 10
  • highlight support

    highlight support

    Adding feature for highlighting in founded text Example:

                $highlight = new Highlight();
                $highlight->setTags(['<mark>'], ['</mark>']);
                $highlight->addField('title', ['matched_fields' => ['title']]);
                $highlight->addField('content', ['matched_fields' => ['content']]);
    
                $highlight->setParameters([
                    'require_field_match' => false,
                    'force_source' => true,
                ]);
    
    
                $search->query->addHighlight($highlight);
    
    opened by mxp100 7
  • change elasticsearch type: string to text

    change elasticsearch type: string to text

    change elasticsearch type: string to text

    https://www.elastic.co/blog/strings-are-dead-long-live-strings

    Before:

    {
      "foo": {
        "type" "string",
        "index": "analyzed"
      }
    }
    

    Now need to be mapped as a text field:

    {
      "foo": {
        "type" "text",
        "index": true
      }
    }
    
    opened by approached 5
  • Feature request: Disable automatically syncs model data for all models

    Feature request: Disable automatically syncs model data for all models

    Hi @ all

    I'am working in a big project. Some developer don't work with elasticsearch. And our continuous integration - test process has not elasticsearch installed yet.

    So me need to disable global all snycs in model. My workaround:

        public $syncDocument;
    
        public function __construct(array $attributes = [])
        {
            $this->syncDocument = config('arena.elasticsearch_enable');
            parent::__construct($attributes);
        }
    

    Has any a idea?

    opened by approached 5
  • [Proposal] Recreate and repopulate an index with no downtime

    [Proposal] Recreate and repopulate an index with no downtime

    Hello,

    I wrote a command for a project I worked on to recreate and repopulate an index with no downtime.

    To understand how it works, here is an example of the output generated by the command on an existing aliased index :

    $> php artisan index:recreate
    
    Recreating default index « demo » ...
    Index already exists and is an alias of « demo_2017-09-25_17-03-14 » (there will be no downtime).
    New index name will be « demo_2017-09-25_17-03-19 ».
    Creating index « demo_2017-09-25_17-03-19 » ...
    Index successfully created !
    Populating the index ...
    Indexing documents of model « App\Models\Article » ...
    Indexing chunk of 1000 documents ...
    Indexing chunk of 79 documents ...
    Documents of model successfully indexed !
    Index successfully populated !
    Moving alias from old indexes to new indexes ...
    Removing alias « demo » from index « demo_2017-09-25_17-03-14 » ...
    Alias successfully removed !
    Adding alias « demo » to index « demo_2017-09-25_17-03-19 » ...
    Alias successfully added !
    Alias successfully moved from old indexes to new indexes !
    Deleting index « demo_2017-09-25_17-03-14 »
    Index successfully deleted !
    Refreshing index « demo_2017-09-25_17-03-19 » ...
    Index successfully refreshed !
    Index successfully recreated !
    

    Recreating the index with zero downtime is done using an alias as recommended by the Elastic Search documentaiton. For what it's worth, I use this technique in production since 2 years and it work very well (the worst that can happen is that the index is not recreated).

    For the moment, repopulation is done via a list of models defined in a configuration file, documents are saved by chunk.

    @sleimanx2 Would you be interested by this feature ? If yes I can open a pull request.

    opened by shaoshiva 5
  • Fielddata is disabled on text fields by default

    Fielddata is disabled on text fields by default

    When I using this code: $books = Book::search() ->multiMatch(['title', 'description'], 'ham on rye', ['fuzziness' => 'AUTO']) ->sortBy('date') ->paginate(); I give a error: Fielddata is disabled on text fields by default. Can you help me to set fielddata=true

    opened by phuongnm153 5
  • is it possible to use auto-generate id by elasticsearch?

    is it possible to use auto-generate id by elasticsearch?

    Per elastico document, they advise to use auto generate id so is it possible to keep model id (db id) inside each document while leave the "_id" field to elasticsearch to decide? Thanks (below is a sample)

    ...
             {
                "_index": "sample",
                "_type": "user",
                "_id": "2",
                "_score": 1,
                "_source": {
                   "first_name": "E",
                   "last_name": "F",
                   "id": 2
                }
             },
             {
                "_index": "sample",
                "_type": "user",
                "_id": "AVlm__uB9pLpNbCey5qK",
                "_score": 1,
                "_source": {
                   "first_name": "A",
                   "last_name": "B",
                   "id": 3
                }
             },
    ...
    
    opened by longthanhtran 5
  • query_parsing_exception: failed to find geo_point field [location]

    query_parsing_exception: failed to find geo_point field [location]

    On model I have 'location' => ['lat' => $this->lat, 'lon' => $this->lng ],

    In mapping $map->point('location')->lat_long(true)->geohash(true);

    It's being saved on ES http://i.imgur.com/V8FKtXS.png

    Tried in kibana if I can build a Tile map, but, No Compatible Fields: The "XXXXX" index pattern does not contain any of the following field types: geo_point

    Any ideas?

    opened by Melcus 5
  • EloquentFiller::isMultiLevelArray() must be of the type array

    EloquentFiller::isMultiLevelArray() must be of the type array

    Hello , I did a search for Elasticsearch, but reported this error, what can I do?

    [Symfony\Component\Debug\Exception\FatalThrowableError] Type error: Argument 1 passed to Sleimanx2\Plastic\Fillers\EloquentFiller::isMultiLevelArray() must be of the type array, integer given, called in /vendor/sleimanx2/plastic/src/Fillers/EloquentFiller.php on line 123

    The query is as follows:

    UserModel::search()->match('user_name', 'admin')->get()

    toDSL

    array:1 [
      "query" => array:1 [
        "match" => array:1 [
          "user_name" => array:1 [
            "query" => "admin"
          ]
        ]
      ]
    ]
    
    opened by xjqxz2 5
  • [ErrorException] filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated

    [ErrorException] filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated

    After execute this command php artisan mapping:rerun i have got this exception [ErrorException] filter_var(): explicit use of FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED is deprecated How can i overcome this exception can anybody help me .

    opened by AtiqulHaque 3
  • Make plastic compatible with Laravel 5.7

    Make plastic compatible with Laravel 5.7

    Please make this compatible with Laravel 5.7. Whenever I do a composer require of the package, it fails and says to uninstall laravel/framework 5.7.25. I would really like to use this over other packages available as it couples nicely with Laravel's models.

    composer require sleimanx2/plastic
    Using version ^0.5.3 for sleimanx2/plastic
    ./composer.json has been updated
    Loading composer repositories with package information
    Updating dependencies (including require-dev)
    Your requirements could not be resolved to an installable set of packages.
    
      Problem 1
        - Installation request for sleimanx2/plastic ^0.5.3 -> satisfiable by sleimanx2/plastic[v0.5.3].
        - Conclusion: remove laravel/framework v5.7.25
        - Conclusion: don't install laravel/framework v5.7.25
    
    opened by annethereshewent 5
  • IAM - Signed Requests using Plastic

    IAM - Signed Requests using Plastic

    I'm having a hard time trying to find out if this is even possible. According to AWS:

    To do authentication with Elasticsearch using IAM roles, you have to add AWS v4 signature headers to the requests being sent to Elasticsearch

    Is this possible using your library? If it is, do you have an example?

    Thanks!

    opened by mwleinad 0
Owner
Sleiman Sleiman
Sleiman Sleiman
Maps Laravel Eloquent models to Elasticsearch types

Elasticquent Elasticsearch for Eloquent Laravel Models Elasticquent makes working with Elasticsearch and Eloquent models easier by mapping them to Ela

Elasticquent 1.3k Jan 4, 2023
Search among multiple models with ElasticSearch and Laravel Scout

For PHP8 support use php8 branch For Laravel Framework < 6.0.0 use 3.x branch The package provides the perfect starting point to integrate ElasticSear

Sergey Shlyakhov 592 Dec 25, 2022
Laravel 8.* Elasticsearch Eloquent

Elasticsearch Installation composer require etsetra/elasticsearch Create config file $ php artisan vendor:publish --tag="etsetra-elasticsearch-config

Etsetra 2 Jan 14, 2022
Laravel package to search through multiple Eloquent models. Supports sorting, pagination, scoped queries, eager load relationships and searching through single or multiple columns.

Laravel Cross Eloquent Search This Laravel package allows you to search through multiple Eloquent models. It supports sorting, pagination, scoped quer

Protone Media 844 Dec 25, 2022
Laravel Scout provides a driver based solution to searching your Eloquent models.

Introduction Laravel Scout provides a simple, driver-based solution for adding full-text search to your Eloquent models. Once Scout is installed and c

The Laravel Framework 1.3k Dec 31, 2022
Illusionist Searcher - Generates database queries based on search syntax

Illusionist Searcher Generates database queries based on search syntax. English | 中文 ✨ Features Zero configuration Compatible with laravel/scout and l

A doer with magic 2 Feb 24, 2022
Elasticsearch driver for Laravel Scout

Elasticsearch driver for Laravel Scout. Contents Compatibility Installation Configuration Basic Usage Advanced Search Migrations Pitfalls Compatibilit

Ivan Babenko 197 Dec 19, 2022
Elasticsearch migrations for Laravel

Elastic Migrations Elasticsearch migrations for Laravel allow you to easily modify and share indices schema across the application's environments. Con

Ivan Babenko 151 Dec 20, 2022
Store and retrieve objects from Algolia or Elasticsearch

Store and retrieve objects from a search index This is an opinionated Laravel 5.1 package to store and retrieve objects from a search index. Currently

Spatie 440 Dec 30, 2022
This package offers advanced functionality for searching and filtering data in Elasticsearch.

Scout Elasticsearch Driver ?? Introducing a new Elasticsearch ecosystem for Laravel. ?? This package offers advanced functionality for searching and f

Ivan Babenko 1.2k Dec 20, 2022
Official PHP low-level client for Elasticsearch.

elasticsearch-php Official low-level client for Elasticsearch. Its goal is to provide common ground for all Elasticsearch-related code in PHP; because

elastic 5k Dec 31, 2022
Elastica is a PHP client for elasticsearch

Elastica: elasticsearch PHP Client All documentation for Elastica can be found under Elastica.io. If you have questions, don't hesitate to ask them on

Nicolas Ruflin 2.2k Dec 23, 2022
Official PHP low-level client for Elasticsearch.

elasticsearch-php Official low-level client for Elasticsearch. Its goal is to provide common ground for all Elasticsearch-related code in PHP; because

elastic 5k Jan 1, 2023
This modules provides a Search API Backend for Elasticsearch.

Search API ElasticSearch This modules provides a Search API Backend for Elasticsearch. This module uses the official Elasticsearch PHP Client. Feature

null 1 Jan 20, 2022
Search products, categories, brands or tags with ElasticSearch

ElasticSearch for Shopaholic This plugin allows you to use ElasticSearch as search engine for Shopaholic. Benefits Easy to install, easy to use Opened

Biz-Mark 4 Feb 18, 2022
Query Builder for Elasticsearch

Query Builder for Elasticsearch

wangzhiqiang 5 Mar 2, 2022
Unmaintained: Laravel Searchy makes user driven searching easy with fuzzy search, basic string matching and more to come!

!! UNMAINTAINED !! This package is no longer maintained Please see Issue #117 Here are some links to alternatives that you may be able to use (I do no

Tom Lingham 533 Nov 25, 2022
A php trait to search laravel models

Searchable, a search trait for Laravel Searchable is a trait for Laravel 4.2+ and Laravel 5.0 that adds a simple search function to Eloquent Models. S

Nicolás López Jullian 2k Dec 27, 2022
Think-scout - A driver based solution to searching your models. Inspired By Laravel Scout

前言 whereof/think-scout根据thinkphp设计思想参考laravel/scout进行扩展 whereof/think-scout 为模型的全文搜索提供了一个简单的、基于驱动程序的解决方案。 目前,Scout 自带了一个 Elasticsearch 驱动;而编写自定义驱动程序很简

wangzhiqiang 6 Mar 18, 2022