577

Product support

Get help in the plugin support forum.

  • Added on May 19, 2020
  • Current version: 1.0.2
  • Platform Compatibility
    v3.x not tested
    v2.x not tested
    v1.x use latest
  • Created by
  • Public repository

Categories

How to use

1 step: Use searchable trait

class Post
{
    public $implement = ['Shohabbos.Elasticsearch.Classess.Searchable'];

    // optional
    // public $useSearchIndex = 'index';

    // optional
    // public $useSearchType = 'type';

    // optional
    // You can specify the fields to be indexed.
    // public function toSearchArray() {
    //      return [
    //            'title' => $this->title
    //      ];
    // }
}

2 step: Search

Find one or find by id

$result = Post::elasticsearch()->find(10);

Query builder

// @var $result Collection
$result = Post::elasticsearch()
        ->select(['title', 'content'])
        ->orderBy("created_at")
        //->orderByDesc('created_at')
        ->limit(10)
        ->where(['content_html' => 'the'])
        //->whereIn('something', ['title^5', 'content'])
        //->rawQuery(['match' => ['field' => 'abs']])
        //->dumpParams()
        ->get();

How to use

1 step: Use searchable trait

class Post
{
    public $implement = ['Shohabbos.Elasticsearch.Classess.Searchable'];

    // optional
    // public $useSearchIndex = 'index';

    // optional
    // public $useSearchType = 'type';

    // optional
    // You can specify the fields to be indexed.
    // public function toSearchArray() {
    //      return [
    //            'title' => $this->title
    //      ];
    // }
}

2 step: Search

Find one or find by id

$result = Post::elasticsearch()->find(10);

Query builder

// @var $result Collection
$result = Post::elasticsearch()
        ->select(['title', 'content'])
        ->orderBy("created_at")
        //->orderByDesc('created_at')
        ->limit(10)
        ->where(['content_html' => 'the'])
        //->whereIn('something', ['title^5', 'content'])
        //->rawQuery(['match' => ['field' => 'abs']])
        //->dumpParams()
        ->get();
1.0.2

Bug fix in settings

May 20, 2020

1.0.1

Initialize plugin.

May 19, 2020