Home

Awesome

<p align="center"> <a href="https://www.elastic.co/products/elasticsearch" target="_blank" rel="external"> <img src="https://images.contentstack.io/v3/assets/bltefdd0b53724fa2ce/blt280217a63b82a734/5bbdaacf63ed239936a7dd56/elastic-logo.svg" height="80px"> </a> <h1 align="center">Elasticsearch Query and ActiveRecord for Yii 2</h1> <br> </p>

This extension provides the Elasticsearch integration for the Yii framework 2.0. It includes basic querying/search support and also implements the ActiveRecord pattern that allows you to store active records in Elasticsearch.

For license information check the LICENSE-file.

Documentation is at docs/guide/README.md.

Latest Stable Version Total Downloads Build Status codecov

Requirements

Depending on the version of Elasticsearch you are using you need a different version of this extension.

Installation

The preferred way to install this extension is through composer:

composer require --prefer-dist yiisoft/yii2-elasticsearch:"~2.1.0"

Configuration

To use this extension, you have to configure the Connection class in your application configuration:

return [
    //....
    'components' => [
        'elasticsearch' => [
            'class' => 'yii\elasticsearch\Connection',
            'nodes' => [
                ['http_address' => '127.0.0.1:9200'],
                // configure more hosts if you have a cluster
            ],
            'dslVersion' => 7, // default is 5
        ],
    ]
];