PHPackages                             mouse/elasticsearch - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. mouse/elasticsearch

ActiveLibrary[Search &amp; Filtering](/categories/search)

mouse/elasticsearch
===================

PHP Client for Elasticsearch

2.3(6y ago)018Apache-2.0PHPPHP &gt;=5.4

Since Jun 10Pushed 6y agoCompare

[ Source](https://github.com/mousemin/elasticsearch)[ Packagist](https://packagist.org/packages/mouse/elasticsearch)[ RSS](/packages/mouse-elasticsearch/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (1)Dependencies (8)Versions (2)Used By (0)

elasticsearch-php
=================

[](#elasticsearch-php)

[![Build Status](https://camo.githubusercontent.com/809ecb9e88173a37bc552e2860ae9e5e98b287b4a92286b3cfa29d0869868e66/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f656c61737469632f656c61737469637365617263682d7068702e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/elastic/elasticsearch-php)

Official low-level client for Elasticsearch. Its goal is to provide common ground for all Elasticsearch-related code in PHP; because of this it tries to be opinion-free and very extendable.

To maintain consistency across all the low-level clients (Ruby, Python, etc), clients accept simple associative arrays as parameters. All parameters, from the URI to the document body, are defined in the associative array.

Features
--------

[](#features)

- One-to-one mapping with REST API and other language clients
- Configurable, automatic discovery of cluster nodes
- Persistent, Keep-Alive connections (within the lifetime of the script)
- Load balancing (with pluggable selection strategy) across all available nodes. Defaults to round-robin
- Pluggable connection pools to offer different connection strategies
- Generalized, pluggable architecture - most components can be replaced with your own custom class if specialized behavior is required
- Option to use asyncronous future, which enables parallel execution of curl requests to multiple nodes

Version Matrix
--------------

[](#version-matrix)

Elasticsearch VersionElasticsearch-PHP Branch&gt;= 2.01.0 or 2.&gt;= 1.0, &lt; 2.01.0 or 2.0&lt;= 0.90.x0.4- If you are using Elasticsearch 2.0+, prefer using the Elasticsearch-PHP 2.0 branch. The 1.0 branch is compatible however.
- If you are using Elasticsearch 1.0+, you must install the `1.0` or `2.0` Elasticsearch-PHP branch.
- If you are using a version older than 1.0, you must install the `0.4` Elasticsearch-PHP branch. Since ES 0.90.x and below is now EOL, the corresponding `0.4` branch will not receive any more development or bugfixes. Please upgrade.
- You should never use Elasticsearch-PHP Master branch, as it tracks Elasticearch master and may contain incomplete features or breaks in backwards compat. Only use ES-PHP master if you are developing against ES master for some reason.

Documentation
-------------

[](#documentation)

[Full documentation can be found here.](http://www.elasticsearch.org/guide/en/elasticsearch/client/php-api/2.0/index.html) Docs are stored within the repo under /docs/, so if you see a typo or problem, please submit a PR to fix it!

Installation via Composer
-------------------------

[](#installation-via-composer)

The recommended method to install *Elasticsearch-PHP* is through [Composer](http://getcomposer.org).

1. Add `elasticsearch/elasticsearch` as a dependency in your project's `composer.json` file (change version to suit your version of Elasticsearch):

    ```
        {
            "require": {
                "elasticsearch/elasticsearch": "~2.0"
            }
        }
    ```
2. Download and install Composer:

    ```
        curl -s http://getcomposer.org/installer | php
    ```
3. Install your dependencies:

    ```
        php composer.phar install --no-dev
    ```
4. Require Composer's autoloader

    Composer also prepares an autoload file that's capable of autoloading all of the classes in any of the libraries that it downloads. To use it, just add the following line to your code's bootstrap process:

    ```
