3. Basic Usage - Osushi/ElasticsearchOrm GitHub Wiki

Elasticsearch Model

<?php

use Osushi\ElasticsearchOrm\Model;

class Sample extends Model
{
    protected $index = 'index';
    protected $type = 'type';

    // protected $mappings = [];
    // protected $connection = 'default';
}

$sample = new Sample();

Elasticsearch Client

<?php

use Osushi\ElasticsearchOrm\Connection;

$es = Connection::create([
    'servers' => [
        [
            "host" => '127.0.0.1',
            "port" => 9200,
            'user' => '',
            'pass' => '',
            'scheme' => 'http',
        ],
    ],
        
    'logging' => [
        'enabled'   => false,
        'level'     => 'all',
        'location'  => base_path('storage/logs/elasticsearch.log'),
    ],  
]);