Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

ElasticSearch PHP client

How to connect to the project on the Phalcon php ElasticSearch PHP client from nervetattoo/elasticsearch

I'm a newbie. Phalcon PHP Installed according to the instructions. Took a typical example of the structure of the project Phalcon MVC Examples -> simple-volt. Now I want to take opportunity work with ElasticSearch server via ElasticSearch ElasticSearch PHP client. But I can not understand how to do it. How do I connect it to the project. Help to understand please.

edited May '14

Did you install Composer and the ElasticSearch PHP client? If not do these steps

Install composer in your project root. curl -s | php

Create composer.json in your project root containing:

    "require" : {
        "nervetattoo/elasticsearch" : ">=2.0"

Run ./composer.phar install

That phar file will check your composer.json file for libraries to download to the vendor folder

In your index.php of Phalcon project paste this

require '../vendor/autoload.php';

That autoload.php is from composer which registers the elasticsearch php client and other libraries. Check to see if the path of autoload.php is properly set Now you can use the class \ElasticSearch\Client in the whole of your project. Example in your indexAction

public function indexAction(){
    $es = new \ElasticSearch\Client::connection('');