Official PHP low-level client for Elasticsearch.

Related tags

php client elasticsearch
Overview

elasticsearch-php

Build status Latest Stable Version Total Downloads

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.

Starting from version 7.4.0, all the endpoints (and namespaces) are autogenerated using the util/GenerateEndpoints.php script. This script reads the Elasticsearch API specs and generated the PHP classes for all the endpoints.

Starting from version 7.7.0 we included also the XPack endpoints of Elasticsearch. These APIs are related to:

Table of Contents

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 asynchronous future, which enables parallel execution of curl requests to multiple nodes

Note: X-Pack endpoints are included from elasticsearch-php 7.7+.

Version Matrix

Elasticsearch Version Elasticsearch-PHP Branch
>= 7.x 7.x
>= 6.6, < 7.0 6.7.x
>= 6.0, < 6.6 6.5.x
>= 5.0, < 6.0 5.0
>= 2.0, < 5.0 1.0 or 2.0
>= 1.0, < 2.0 1.0 or 2.0
<= 0.90.x 0.4
  • If you are using Elasticsearch 7.x you can use use Elasticsearch-PHP 7.x branch
  • If you are using Elasticsearch 6.6 to 6.7, use Elasticsearch-PHP 6.7.x branch.
  • If you are using Elasticsearch 6.0 to 6.5, use Elasticsearch-PHP 6.5.x branch.
  • If you are using Elasticsearch 5.x, use Elasticsearch-PHP 5.0 branch.
  • If you are using Elasticsearch 1.x or 2.x, prefer using the Elasticsearch-PHP 2.0 branch. The 1.0 branch is compatible however.
  • 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 Elasticsearch master and may contain incomplete features or breaks in backwards compatibility. Only use ES-PHP master if you are developing against ES master for some reason.

Documentation

Full documentation can be found here. Docs are stored within the repo under /docs/, so if you see a typo or problem, please submit a PR to fix it!

We also provide a code examples generator for PHP using the util/GenerateDocExamples.php script. This command parse the util/alternative_report.spec.json file produced from this JSON specification and it generates the PHP examples foreach digest value. The examples are stored in asciidoc format under docs/examples folder.

Installation via Composer

The recommended method to install Elasticsearch-PHP is through Composer.

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

        {
            "require": {
                "elasticsearch/elasticsearch": "^7.0"
            }
        }
  2. Download and install Composer:

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

        php composer.phar install
  4. Require Composer's autoloader

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

        <?php
    
        use Elasticsearch\ClientBuilder;
    
        require 'vendor/autoload.php';
    
        $client = ClientBuilder::create()->build();

You can find out more on how to install Composer, configure autoloading, and other best-practices for defining dependencies at getcomposer.org.

PHP Version Requirement

Version 7.0 of this library requires at least PHP version 7.1. In addition, it requires the native JSON extension to be version 1.3.7 or higher.

Elasticsearch-PHP Branch PHP Version
7.0 >= 7.1.0
6.0 >= 7.0.0
5.0 >= 5.6.6
2.0 >= 5.4.0
0.4, 1.0 >= 5.3.9

Quickstart

Index a document

In elasticsearch-php, almost everything is configured by associative arrays. The REST endpoint, document and optional parameters - everything is an associative array.

To index a document, we need to specify three pieces of information: index, id and a document body. This is done by constructing an associative array of key:value pairs. The request body is itself an associative array with key:value pairs corresponding to the data in your document:

$params = [
    'index' => 'my_index',
    'id'    => 'my_id',
    'body'  => ['testField' => 'abc']
];

$response = $client->index($params);
print_r($response);

The response that you get back indicates the document was created in the index that you specified. The response is an associative array containing a decoded version of the JSON that Elasticsearch returns:

Array
(
    [_index] => my_index
    [_type] => _doc
    [_id] => my_id
    [_version] => 1
    [result] => created
    [_shards] => Array
        (
            [total] => 1
            [successful] => 1
            [failed] => 0
        )

    [_seq_no] => 0
    [_primary_term] => 1
)

Get a document

Let's get the document that we just indexed. This will simply return the document:

$params = [
    'index' => 'my_index',
    'id'    => 'my_id'
];

$response = $client->get($params);
print_r($response);

The response contains some metadata (index, version, etc.) as well as a _source field, which is the original document that you sent to Elasticsearch.

Array
(
    [_index] => my_index
    [_type] => _doc
    [_id] => my_id
    [_version] => 1
    [_seq_no] => 0
    [_primary_term] => 1
    [found] => 1
    [_source] => Array
        (
            [testField] => abc
        )

)

If you want to retrieve the _source field directly, there is the getSource method:

$params = [
    'index' => 'my_index',
    'id'    => 'my_id'
];

$source = $client->getSource($params);
print_r($source);

The response will be just the _source value:

Array
(
    [testField] => abc
)

Search for a document

Searching is a hallmark of Elasticsearch, so let's perform a search. We are going to use the Match query as a demonstration:

$params = [
    'index' => 'my_index',
    'body'  => [
        'query' => [
            'match' => [
                'testField' => 'abc'
            ]
        ]
    ]
];

$response = $client->search($params);
print_r($response);

The response is a little different from the previous responses. We see some metadata (took, timed_out, etc.) and an array named hits. This represents your search results. Inside of hits is another array named hits, which contains individual search results:

Array
(
    [took] => 33
    [timed_out] =>
    [_shards] => Array
        (
            [total] => 1
            [successful] => 1
            [skipped] => 0
            [failed] => 0
        )

    [hits] => Array
        (
            [total] => Array
                (
                    [value] => 1
                    [relation] => eq
                )

            [max_score] => 0.2876821
            [hits] => Array
                (
                    [0] => Array
                        (
                            [_index] => my_index
                            [_type] => _doc
                            [_id] => my_id
                            [_score] => 0.2876821
                            [_source] => Array
                                (
                                    [testField] => abc
                                )

                        )

                )

        )

)

Delete a document

Alright, let's go ahead and delete the document that we added previously:

$params = [
    'index' => 'my_index',
    'id'    => 'my_id'
];

$response = $client->delete($params);
print_r($response);

You'll notice this is identical syntax to the get syntax. The only difference is the operation: delete instead of get. The response will confirm the document was deleted:

Array
(
    [_index] => my_index
    [_type] => _doc
    [_id] => my_id
    [_version] => 2
    [result] => deleted
    [_shards] => Array
        (
            [total] => 1
            [successful] => 1
            [failed] => 0
        )

    [_seq_no] => 1
    [_primary_term] => 1
)

Delete an index

Due to the dynamic nature of Elasticsearch, the first document we added automatically built an index with some default settings. Let's delete that index because we want to specify our own settings later:

$deleteParams = [
    'index' => 'my_index'
];
$response = $client->indices()->delete($deleteParams);
print_r($response);

The response:

Array
(
    [acknowledged] => 1
)

Create an index

Now that we are starting fresh (no data or index), let's add a new index with some custom settings:

$params = [
    'index' => 'my_index',
    'body'  => [
        'settings' => [
            'number_of_shards' => 2,
            'number_of_replicas' => 0
        ]
    ]
];

$response = $client->indices()->create($params);
print_r($response);

Elasticsearch will now create that index with your chosen settings, and return an acknowledgement:

Array
(
    [acknowledged] => 1
)

Unit Testing using Mock a Elastic Client

use GuzzleHttp\Ring\Client\MockHandler;
use Elasticsearch\ClientBuilder;

// The connection class requires 'body' to be a file stream handle
// Depending on what kind of request you do, you may need to set more values here
$handler = new MockHandler([
  'status' => 200,
  'transfer_stats' => [
     'total_time' => 100
  ],
  'body' => fopen('somefile.json'),
  'effective_url' => 'localhost'
]);
$builder = ClientBuilder::create();
$builder->setHosts(['somehost']);
$builder->setHandler($handler);
$client = $builder->build();
// Do a request and you'll get back the 'body' response above

Contributing

If you want to contribute to this project you need to subscribe a Contributor Agreement. If you want to send a PR for version Y please use the Y.x branch. For instance if you want to send a PR for elasticsearch-php 7 use the 7.x branch.

Never send PR to master unless you want to contribute to the development version of the client (master represents the next major version).

Each PR should include a unit test using PHPUnit. If you are not familiar with PHPUnit you can have a look at this reference.

Wrap up

That was just a crash-course overview of the client and its syntax. If you are familiar with Elasticsearch, you'll notice that the methods are named just like REST endpoints.

You'll also notice that the client is configured in a manner that facilitates easy discovery via the IDE. All core actions are available under the $client object (indexing, searching, getting, etc.). Index and cluster management are located under the $client->indices() and $client->cluster() objects, respectively.

Check out the rest of the Documentation to see how the entire client works.

Available Licenses

Starting with version 1.3.1, Elasticsearch-PHP is available under two licenses: Apache v2.0 and LGPL v2.1. Versions prior to 1.3.1 are still licensed with only Apache v2.0.

The user may choose which license they wish to use. Since there is no discriminating executable or distribution bundle to differentiate licensing, the user should document their license choice externally, in case the library is re-distributed. If no explicit choice is made, assumption is that redistribution obeys rules of both licenses.

Contributions

All contributions to the library are to be so that they can be licensed under both licenses.

Apache v2.0 License:

Copyright 2013-2016 Elasticsearch

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

LGPL v2.1 Notice:

Copyright (C) 2013-2016 Elasticsearch

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Issues
  • Bulk Indexing

    Bulk Indexing

    Hello,

    My name is Austin Harmon and I am new to elastic search. I am looking to index a couple hundred thousand documents with elastic search and I would like to use the php client to do it. I have my index set up with one shard and one replica since I have a smaller amount of documents. I have looked over all the syntax on the elastic search site and github. This is what my index.php file looks like:

    array( 'index' => 'rvuehistoricaldocuments2009-2013', 'type' => 'documents', '_id' => $i, 'body' => array( '_source' => array( //everthing in body is mapping code 'enabled' => true ), 'properties' => array( 'doc_name' => array( 'type' => 'string', 'analyzer' => 'standard' ), 'description' => array( 'type' => 'string' ) ) ); $params['body'][] = array ( 'rVuedoc'$i => 'ID'$i ); $indexParams['body']['mappings']['documents'] = $myTypeMapping; //mapping code } json_encode($params); $client->indices()->create($indexParams); //mapping code $responses = $client->bulk($params); ``` ?>

    I'm not sure if I have everything I need or if I'm doing this right so if you could let me know if this looks correct that would be very helpful.

    Thank you, Austin Harmon

    opened by Blackhawk2165 34
  • Compatibility issues with version 7.4.0

    Compatibility issues with version 7.4.0

    Summary of problem or feature request

    Since version 7.4.0 was published, it seems some classes were renamed which break compatiblity.

    For example, Elasticsearch\Endpoints\Ingest\Pipeline\Delete was renamed to Elasticsearch\Endpoints\Ingest\DeletePipeline

    See https://github.com/ruflin/Elastica/issues/1710 for reference.

    opened by deguif 29
  • No alive nodes found in your cluster in v5.0

    No alive nodes found in your cluster in v5.0

    Summary of problem or feature request

    I am using the search feature of elastic search but this error is coming out while running my files on localhost.

    my configuration code:

    use Elasticsearch\ClientBuilder;

    require 'vendor/autoload.php'; $client = Elasticsearch\ClientBuilder::create()->build();

    the error while sending a query for search :

    Fatal error: Uncaught Elasticsearch\Common\Exceptions\NoNodesAvailableException: No alive nodes found in your cluster in C:\xampp\htdocs\elastic\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ConnectionPool\StaticNoPingConnectionPool.php:51 Stack trace: #0 C:\xampp\htdocs\elastic\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Transport.php(72): Elasticsearch\ConnectionPool\StaticNoPingConnectionPool->nextConnection() #1 C:\xampp\htdocs\elastic\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Transport.php(90): Elasticsearch\Transport->getConnection() #2 C:\xampp\htdocs\elastic\vendor\elasticsearch\elasticsearch\src\Elasticsearch\Connections\Connection.php(227): Elasticsearch\Transport->performRequest('GET', '/1/books/_searc...', Array, '{"query":{"matc...', Array) #3 C:\xampp\htdocs\elastic\vendor\react\promise\src\FulfilledPromise.php(25): Elasticsearch\Connections\Connection->Elasticsearch\Connections{closure}(Array) #4 C:\xampp\htdocs\elastic\vendor\guzzlehttp\ringphp\src\Future\CompletedFutureValue.ph in C:\xampp\htdocs\elastic\vendor\elasticsearch\elasticsearch\src\Elasticsearch\ConnectionPool\StaticNoPingConnectionPool.php on line 51

    please help me fix this problem. I am using localhost through XAMPP.

    • Operating System - windows
    • PHP Version - 7
    • ES-PHP client version - v5.0
    • Elasticsearch version - v5.0
    opened by zmf0507 26
  • Drop support for PHP 5.3?

    Drop support for PHP 5.3?

    PHP 5.3 was released six years ago, in June of 2009. It was EOL'd four months ago, in August 2014.

    Many popular PHP libraries, such as Guzzle, Drupal 8, Laravel, and Magento, have already migrated to PHP 5.4

    The change would introduce the usual bevy of bug fixes, performance enhancements, security fixes and new features (array shorthand and traits are most likely to be used by this project). But the biggest benefit would be fitting into the 5.4. ecosystem and being able to leverage projects like Guzzle4.

    Thoughts? How many people are still stuck on PHP 5.3 and unable to upgrade?

    2.0 breaking question 
    opened by polyfractal 21
  • NoNodesAvailableException in StaticNoPingConnectionPool.php : No alive nodes found in your cluster

    NoNodesAvailableException in StaticNoPingConnectionPool.php : No alive nodes found in your cluster

    I use elasticsearch v 5.5.2 with laravel 5.3 - scout v -2.0. I a trying to executing below code but I am getting this error. NoNodesAvailableException.

    namespace App\Http\Controllers;
    
    use Illuminate\Http\Request;
    use Elasticsearch\ClientBuilder;
    use Elastica\Client as ElasticaClient;
    
    class clientController extends Controller
    {
        protected $elasticsearch;
        protected $elastica;
        public function __construct()
        {
            $this->elasticsearch = ClientBuilder::create()
                    //->setConnectionPool('\Elasticsearch\ConnectionPool\SniffingConnectionPool', [])
                    ->build();
            $elasticConfig=['host'=>"locahost",
                "port"=>9200,
                "index"=>'pets'];
            $this->elastica = new  ElasticaClient($elasticConfig);
        }
        public function elasticsearchTest(){
    
            $param = [
                'index' => 'pets',
                'type' => 'dog',
                'id'=>'1'
            ];
            $res = $this->elasticsearch->get($param);
            dump($res); 
        }
    }
    

    NoNodesAvailableException in StaticNoPingConnectionPool.php line 51: No alive nodes found in your cluster It's working fine in sense. Result:

    {
       "_index": "pets",
       "_type": "dog",
       "_id": "1",
       "_version": 1,
       "found": true,
       "_source": {
          "name": "tommy",
          "age": "3",
          "color": "black",
          "gender": "male"
       }
    }
    

    Also working on http://localhost:9200/pets/dog/1. Result:

    {"_index":"pets","_type":"dog","_id":"1","_version":1,"found":true,"_source":{
        "name":"tommy",
        "age":"3",
        "color":"black",
        "gender":"male"
    }
    }
    

    I also post this on stackover flow but no response.

    opened by manoj-infrasssist 21
  • Port is missing from log messages

    Port is missing from log messages

    Summary of problem or feature request

    I can see that in v.7 the port has disappeared from the host. After further digging I see it's been specifically requested and fixed in https://github.com/elastic/elasticsearch-php/issues/548 & https://github.com/elastic/elasticsearch-php/pull/782

    Perhaps it is a valid use case (although I don't really understand it), but the change seems to be causing problems elsewhere - now the port is missing from the log messages too.

    Code snippet of problem

    Here is an example of what is sent to the logger now:

    array(8) {
      ["message"]=>
      string(66) "curl -XDELETE 'http://127.0.0.1/sineflow-esb-test-bar?pretty=true'"
      ["context"]=>
      array(0) {
      }
      ["level"]=>
      int(200)
      ["level_name"]=>
      string(4) "INFO"
      ["channel"]=>
      string(10) "sfes_trace"
      ["datetime"]=>
      object(DateTime)#108 (3) {
        ["date"]=>
        string(26) "2019-08-03 12:53:10.801795"
        ["timezone_type"]=>
        int(3)
        ["timezone"]=>
        string(15) "Europe/Helsinki"
      }
      ["extra"]=>
      array(1) {
        ["backtrace"]=>
        NULL
      }
      ["formatted"]=>
      string(112) "[2019-08-03 12:53:10] sfes_trace.INFO: curl -XDELETE 'http://127.0.0.1/sineflow-esb-test-bar?pretty=true' [] []
    "
    }
    array(8) {
      ["message"]=>
      string(9) "Response:"
      ["context"]=>
      array(5) {
        ["response"]=>
        array(1) {
          ["acknowledged"]=>
          bool(true)
        }
        ["method"]=>
        string(6) "DELETE"
        ["uri"]=>
        string(38) "http://127.0.0.1/sineflow-esb-test-bar"
        ["HTTP code"]=>
        int(200)
        ["duration"]=>
        float(0.026726)
      }
      ["level"]=>
      int(100)
      ["level_name"]=>
      string(5) "DEBUG"
      ["channel"]=>
      string(10) "sfes_trace"
      ["datetime"]=>
      object(DateTime)#111 (3) {
        ["date"]=>
        string(26) "2019-08-03 12:53:10.802988"
        ["timezone_type"]=>
        int(3)
        ["timezone"]=>
        string(15) "Europe/Helsinki"
      }
      ["extra"]=>
      array(1) {
        ["backtrace"]=>
        NULL
      }
      ["formatted"]=>
      string(189) "[2019-08-03 12:53:10] sfes_trace.DEBUG: Response: {"response":{"acknowledged":true},"method":"DELETE","uri":"http://127.0.0.1/sineflow-esb-test-bar","HTTP code":200,"duration":0.026726} []
    "
    }
    

    Based on this information, I should be able to type in the terminal:

    curl -XDELETE 'http://127.0.0.1/sineflow-esb-test-bar?pretty=true'
    

    But of course this doesn't work, as it's trying to reach port 80, instead of 9200

    7.0 
    opened by pmishev 21
  • Strange behaviour

    Strange behaviour

    I'm trying a simple get, everything works fine, but when I use Sense to run a PUT to update the document, if I try to retrieve the document via php I get an empty response.

    Is like it's not synced correctly.

    I'm I missing something here?

    Thanks!

    opened by manelet 21
  • SSL cert error

    SSL cert error

    I am receiving the following error when trying to use the DELETE API.

    Elasticsearch\\Common\\Exceptions\\TransportException","message":"SSL certificate problem: self signed certificate in certificate chain","file":"\pathto\/vendor\/elasticsearch\/elasticsearch\/src\/Elasticsearch\/Connections\/AbstractConnection.php","line":312

    in my config file I am setting the verification to false. this is working for everything except delete.

    update: I have done some research and it seems that the curl_opt - CURLOPT_SSL_VERIFYPEER is not getting set to false, is there a way to pass this using a config file to the elastic search client?

    opened by warroyo 19
  • Search method returns NULL

    Search method returns NULL

    I'm having a puzzling problem with a website that uses Elasticsearchβ€”Elasticsearch is returning results to elasticsearch-php, which is then mysteriously failing to output them. This is with Elasticsearch v0.90.9, elasticsearch-php v0.4.5, and PHP v5.3.10. (Just in case, I've also tried elasticsearch-php v1.2.0, despite its incompatibility with pre-v1.0 Elasticsearch, which presented precisely the same problem.)

    When I directly query my Elasticsearch index, Elasticsearch happily returns the results. That's if I make the request via cURL. If I make the request via elasticsearch-php, Elasticsearch still returns the results, but they don't make it past elasticsearch-php.

    For example, here I search for a term that I know will return a small number of results (Jaquith, my last name) from my index (business) of a couple of million records:

    require 'vendor/autoload.php';
    $config['logging'] = TRUE;
    $client = new Elasticsearch\Client($config);
    $params['index'] = 'business';
    $params['body']['query']['match']['_all'] = 'Jaquith';
    $result = $client->search($params);
    var_dump($result);
    

    The output of var_dump($result) is NULL. Not false, but NULL. If I I deliberately specify invalid options, such as an invalid index (e.g., $params['index'] = 'fake_index'), then it returns false, so it's not like it can only return NULL.

    Where things get weird is when looking at elasticsearch.log. Here is what's logged from the execution of the above:

    [2014-08-04 21:34:13] log.DEBUG: Request Body ["{\"query\":{\"match\":{\"_all\":\"Jaquith\"}}}"] {"file":"/vol/www/business.openva.com/htdocs/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/AbstractConnection.php","line":113,"class":"Elasticsearch\\Connections\\AbstractConnection","function":"logRequestSuccess"}
    [2014-08-04 21:34:13] log.INFO: Request Success: {"method":"POST","uri":"http://localhost:9200/business/_search","headers":{"host":["localhost:9200"],"user-agent":["Guzzle/3.9.1 curl/7.22.0 PHP/5.3.10-1ubuntu3.13"],"content-length":[38]},"HTTP code":200,"duration":0.009757} {"file":"/vol/www/business.openva.com/htdocs/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/AbstractConnection.php","line":123,"class":"Elasticsearch\\Connections\\AbstractConnection","function":"logRequestSuccess"}
    [2014-08-04 21:34:13] log.DEBUG: Response ["{\"took\":7,\"timed_out\":false,\"_shards\":{\"total\":5,\"successful\":5,\"failed\":0},\"hits\":{\"total\":4,\"max_score\":6.5482264,\"hits\":[{\"_index\":\"business\",\"_type\":\"5\",\"_id\":\"ZTU0BFYcSIWQWZYdCaNS1g\",\"_score\":6.5482264, \"_source\" : {\"first_name\": \"MARY\", \"last_name\": \"JAQUITH\", \"middle_name\": \"\", \"id\": \"0562703\", \"title\": \"PRESIDENT\"},},{\"_index\":\"business\",\"_type\":\"5\",\"_id\":\"L9PNiEdUSGmbZAq1bgPjQQ\",\"_score\":4.9117994, \"_source\" : {\"first_name\": \"MARY\", \"last_name\": \"JAQUITH\", \"middle_name\": \"T\", \"id\": \"0562703\", \"title\": \"S/T\"},},{\"_index\":\"business\",\"_type\":\"9\",\"_id\":\"C7Web8w6T0S1zhyUtbjaAw\",\"_score\":2.0459418, \"_source\" : {\"expiration-date\": null, \"agent-state\": \"VA\", \"agent_status\": \"1\", \"agent_court_locality\": \"LOUDOUN COUNTY\", \"state-formed\": \"VIRGINIA\", \"id\": \"S496907\", \"agent-name\": \"NATALIE ANDERSON JAQUITH\", \"city\": \"Sterling\", \"zip\": \"20164\", \"state\": \"VA\", \"agent-city\": \"STERLING\", \"status\": \"ACTIVE\", \"agent_zip\": \"20164\", \"street-2\": \"\", \"street-1\": \"206 Laura Anne Drive\", \"date\": \"2014-03-17\", \"agent-street-1\": \"206 LAURA ANNE DRIVE\", \"agent_date\": \"2014-03-17\", \"name\": \"Happy Little Paintings, LLC\", \"agent-street-2\": \"\", \"industry\": \"00\", \"status-date\": \"2014-03-17\", \"address-date\": null},},{\"_index\":\"business\",\"_type\":\"2\",\"_id\":\"0LYakZfaTaKj4lGxaF0hGw\",\"_score\":1.6373172, \"_source\" : {\"agent_name\": \"MARY G JAQUITH\", \"address_date\": null, \"stock_ind\": \"S\", \"agent_status\": \"OFFICER\", \"agent_court_locality\": \"VIRGINIA BEACH CITY\", \"total_shares\": \"00000005000\", \"incorporation_date\": \"2001-08-02\", \"stock_class\": \"00000000\", \"id\": \"0562703\", \"city\": \"VA BEACH\", \"zip\": \"23457\", \"state\": \"VA\", \"assessment\": \"NORMAL ASSESSMENT\", \"merged\": \"\", \"state_formed\": \"VIRGINIA\", \"status\": \"ACTIVE\", \"agent_zip\": \"23457\", \"agent_city\": \"VIRGINIA BEACH\", \"status_date\": \"2009-03-10\", \"street_1\": \"4166 CHARITY NECK ROAD\", \"street_2\": \"\", \"agent_date\": \"2013-04-29\", \"name\": \"CORNERSTONE FARMS, LTD.\", \"expiration_date\": null, \"industry\": \"GENERAL\", \"agent_street_1\": \"4166 CHARITY NECK RD.\", \"agent_street_2\": \"\", \"number_shares\": \"00000000000\", \"agent_state\": \"VA\"},}]}}"] {"file":"/vol/www/business.openva.com/htdocs/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/AbstractConnection.php","line":124,"class":"Elasticsearch\\Connections\\AbstractConnection","function":"logRequestSuccess"}
    [2014-08-04 21:34:13] trace.INFO: curl -XPOST 'http://localhost:9200/business/_search?pretty=true' -d '{"query":{"match":{"_all":"Jaquith"}}}' [] []
    [2014-08-04 21:34:13] trace.DEBUG: Response: {"response":"{\"took\":7,\"timed_out\":false,\"_shards\":{\"total\":5,\"successful\":5,\"failed\":0},\"hits\":{\"total\":4,\"max_score\":6.5482264,\"hits\":[{\"_index\":\"business\",\"_type\":\"5\",\"_id\":\"ZTU0BFYcSIWQWZYdCaNS1g\",\"_score\":6.5482264, \"_source\" : {\"first_name\": \"MARY\", \"last_name\": \"JAQUITH\", \"middle_name\": \"\", \"id\": \"0562703\", \"title\": \"PRESIDENT\"},},{\"_index\":\"business\",\"_type\":\"5\",\"_id\":\"L9PNiEdUSGmbZAq1bgPjQQ\",\"_score\":4.9117994, \"_source\" : {\"first_name\": \"MARY\", \"last_name\": \"JAQUITH\", \"middle_name\": \"T\", \"id\": \"0562703\", \"title\": \"S/T\"},},{\"_index\":\"business\",\"_type\":\"9\",\"_id\":\"C7Web8w6T0S1zhyUtbjaAw\",\"_score\":2.0459418, \"_source\" : {\"expiration-date\": null, \"agent-state\": \"VA\", \"agent_status\": \"1\", \"agent_court_locality\": \"LOUDOUN COUNTY\", \"state-formed\": \"VIRGINIA\", \"id\": \"S496907\", \"agent-name\": \"NATALIE ANDERSON JAQUITH\", \"city\": \"Sterling\", \"zip\": \"20164\", \"state\": \"VA\", \"agent-city\": \"STERLING\", \"status\": \"ACTIVE\", \"agent_zip\": \"20164\", \"street-2\": \"\", \"street-1\": \"206 Laura Anne Drive\", \"date\": \"2014-03-17\", \"agent-street-1\": \"206 LAURA ANNE DRIVE\", \"agent_date\": \"2014-03-17\", \"name\": \"Happy Little Paintings, LLC\", \"agent-street-2\": \"\", \"industry\": \"00\", \"status-date\": \"2014-03-17\", \"address-date\": null},},{\"_index\":\"business\",\"_type\":\"2\",\"_id\":\"0LYakZfaTaKj4lGxaF0hGw\",\"_score\":1.6373172, \"_source\" : {\"agent_name\": \"MARY G JAQUITH\", \"address_date\": null, \"stock_ind\": \"S\", \"agent_status\": \"OFFICER\", \"agent_court_locality\": \"VIRGINIA BEACH CITY\", \"total_shares\": \"00000005000\", \"incorporation_date\": \"2001-08-02\", \"stock_class\": \"00000000\", \"id\": \"0562703\", \"city\": \"VA BEACH\", \"zip\": \"23457\", \"state\": \"VA\", \"assessment\": \"NORMAL ASSESSMENT\", \"merged\": \"\", \"state_formed\": \"VIRGINIA\", \"status\": \"ACTIVE\", \"agent_zip\": \"23457\", \"agent_city\": \"VIRGINIA BEACH\", \"status_date\": \"2009-03-10\", \"street_1\": \"4166 CHARITY NECK ROAD\", \"street_2\": \"\", \"agent_date\": \"2013-04-29\", \"name\": \"CORNERSTONE FARMS, LTD.\", \"expiration_date\": null, \"industry\": \"GENERAL\", \"agent_street_1\": \"4166 CHARITY NECK RD.\", \"agent_street_2\": \"\", \"number_shares\": \"00000000000\", \"agent_state\": \"VA\"},}]}}","method":"POST","uri":"http://localhost:9200/business/_search","HTTP code":200,"duration":0.009757} []
    

    Elasticsearch returns results just fine. Somewhere between elasticsearch-php receiving that JSON and returning the content as PHP it's becoming, simply, NULL.

    There's a non-trivial chance that I'm doing something stupid here, but I can't figure out what it is. Any ideas of what's going on?

    opened by waldoj 19
  • client->indices()->stats fails with

    client->indices()->stats fails with "No alive nodes in your cluster" exception

    Summary of problem or feature request

    The call to indices->stats(INDEX_NAME) throw an Exception "No alive nodes in your cluster" The cluster is single node, and respond correctly to other client calls, through PHP client our curl

    Code snippet of problem

    $this->client->indices()->stats(['index'=>'es-index']);

    System details

    • Operating System : Debian buster / boot2docker
    • PHP Version : 7.4
    • ES-PHP client version : 7.3
    • Elasticsearch version : 7.13
    waiting author update 
    opened by FxNion 2
  • Search iterators are broken

    Search iterators are broken

    Search iterators are broken

    It seems that after #1044 SearchResponseIterator is broken: a deprecation error is thrown on an attempt to iterate the search result.

    Code snippet of problem

    $res = new SearchHitIterator(new SearchResponseIterator($client, $params));
    foreach ($res as $hit) {
        //
    }
    

    System details

    • Operating System: Alpine Linux
    • PHP Version: 8.0
    • ES-PHP client version: 7.12
    • Elasticsearch version: 7.4

    There is my PR #1134 with the suggested fix

    opened by bakurin 0
  • 6.7.x

    6.7.x

    This is just small changes in the code to be compatible with PHP 8 in composer.json and another deprecated usage of parameter after another parameter with default value.

    opened by fghamsary 0
  • Sync composer licence

    Sync composer licence

    The repo suggests its a multi license, this gives composer the same information

    opened by exussum12 2
  • Update search iterators to send

    Update search iterators to send "scroll_id" inside the request body

    Moving scroll_id into requires body #1044 brakes SearchResponseIterator by triggering deprecation error.

    The goal of this PR is to change the iterator classes as described in the doc to avoid deprecation error

    opened by bakurin 1
  • [6.8.x] ForceMerge renamed to Forcemerge

    [6.8.x] ForceMerge renamed to Forcemerge

    Summary of problem or feature request

    Elasticsearch\Endpoints\Indices\ForceMerge was renamed to Elasticsearch\Endpoints\Indices\Forcemerge here.

    Reference: https://github.com/ruflin/Elastica/pull/1947#issuecomment-804969412 & https://github.com/ruflin/Elastica/pull/1948

    BC break 
    opened by kbond 4
  • index function why not support array?

    index function why not support array?

    Summary of problem or feature request

    Code snippet of problem

    image dsl ,this is ok.

    $params   = [
                'index' => 'test',
                'type'  => 'test',
                'id'    => '6',
                'body'  => ['int1' => [6, 7]]
            ];
            $client   = DiHelper::getEs();
            $response = $client->index($params);
            print_r($response);
    
    
    
    

    err log

    
    "code": "-101",
    \nError Code: 400\n\n#0 /web/website/bobo.com/composer/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(295): Elasticsearch\\Connections\\Connection->process4xxError(Array, Array, Array)\n#1 /web/website/bobo.com/composer/vendor/react/promise/src/FulfilledPromise.php(28): Elasticsearch\\Connections\\Connection->Elasticsearch\\Connections\\{closure}(Array)\n#2 
    
    /web/website/bobo.com/composer/vendor/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php(55): React\\Promise\\FulfilledPromise->then(Object(Closure), NULL, NULL)\n#3 /web/website//bobo.com/composer/vendor/guzzlehttp/ringphp/src/Core.php(341): GuzzleHttp\\Ring\\Future\\CompletedFutureValue->then(Object(Closure), NULL, NULL)\n#4 
    
    /web/website/bobo.com/composer/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(315): GuzzleHttp\\Ring\\Core::proxy(Object(GuzzleHttp\\Ring\\Future\\CompletedFutureArray), Object(Closure))\n#5 /web/website/bobo.com/composer/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php(187): Elasticsearch\\Connections\\Connection->Elasticsearch\\Connections\\{closure}(Array, Object(Elasticsearch\\Connections\\Connection), Object(Elasticsearch\\Transport), Array)\n#6 /web/website/bobo.com/composer/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Transport.php(107): Elasticsearch\\Connections\\Connection->performRequest('PUT', '/test/test/7/_c...', Array, '{\"int1\":[4,5]}', Array, Object(Elasticsearch\\Transport))\n#7 
    
    
    /web/website/bobo.com/composer/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php(1586): Elasticsearch\\Transport->performRequest('PUT', '/test/test/7/_c...', Array, Array, Array)\n#8 /web/website//bobo.com/composer/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Client.php(760): Elasticsearch\\Client->performRequest(Object(Elasticsearch\\Endpoints\\Create))\n#9 
    
    /web/website/bobo.com/app/backend/Controllers/TestController.php(231): Elasticsearch\\Client->create(Array)\n#10 [internal function]: TestController->esV1Action('App\\\\Backend\\\\Con...', 'test', 'es', 'v1', 'test/es/v1', '/v1/test/es')\n#11 [internal function]: Phalcon\\Dispatcher->callActionMethod(Object(TestController), 'esV1Action', Array)\n#12 [internal function]: Phalcon\\Dispatcher->dispatch()\n#13 /web/website/bobo.com/app/Sdks/Core/System/Application/CustomApplication.php(28): Phalcon\\Mvc\\Application->handle()\n#14 /web/website/bobo.com/app/bootstrap/bootstrap.php(142): 
    
    App\\Sdks\\Core\\System\\Application\\CustomApplication->run()\n#15 /web/website/bobo.com/public/index.php(4): require('/web/website/co...')\n#16 {main}\narray (\n  'Hm_lvt_43f07e50f9738318fa872f35b04004c9' => '1612249465,1612768050',\n  '_url' => '/v1/test/es',\n)\n",
    
    
    

    System details

    • Operating System
    • PHP Version
    • 7.3
    • ES-PHP client version
    • 6.*
    • Elasticsearch version -6.8
    waiting author update 
    opened by feng99 3
  • Upgrade Doctum to 5.4.1 and twig templates to Twig 3

    Upgrade Doctum to 5.4.1 and twig templates to Twig 3

    • Upgrade Doctum to 5.4.1
    • Upgrade Twig templates to Twig 3
    opened by williamdes 1
  • Throw an exception on unsuccessful bulk operations

    Throw an exception on unsuccessful bulk operations

    Summary of problem or feature request

    Bulk API returns 200 status code even in case some operations have failed, but the response body contains a flag (errors=false), which can be used to identify the overall request result. See more details in the official ES documentation.

    This is very inconvenient to parse the response in every project and check if there were errors or not. It would be really nice to get some generic exception when one or more operations did not complete successfully. It can be configurable if this matters.

    Code snippet of problem

    Here is an example of unsuccessful bulk indexing:

    {
       "took":1,
       "errors":true,
       "items":[
          {
             "index":{
                "_index":"books",
                "_type":"_doc",
                "_id":"2",
                "status":400,
                "error":{
                   "type":"mapper_parsing_exception",
                   "reason":"failed to parse field [published] of type [date] in document with id '2'. Preview of field's value: '2020'",
                   "caused_by":{
                      "type":"illegal_argument_exception",
                      "reason":"failed to parse date field [2020] with format [yyyy-MM-dd]",
                      "caused_by":{
                         "type":"date_time_parse_exception",
                         "reason":"Text '2020' could not be parsed at index 4"
                      }
                   }
                }
             }
          }
       ]
    }
    
    enhancement 
    opened by babenkoivan 2
  • Update Connection.php

    Update Connection.php

    Fix function signature of performRequest to match declaration in ConnectionInterface

    Issue:

    Fatal error: 
    Declaration of Elasticsearch\Connections\Connection::performRequest($method, $uri, $params = NULL, $body = NULL, $options = Array, ?Elasticsearch\Transport $transport = NULL) 
    must be compatible with 
    Elasticsearch\Connections\ConnectionInterface::performRequest(string $method, string $uri, ?array $params = Array, $body = NULL, array $options = Array, ?Elasticsearch\Transport $transport = NULL) 
    in /mnt/volume-lon1-01/var/www/xxxx/vendor/elasticsearch/elasticsearch/src/Elasticsearch/Connections/Connection.php on line 49
    

    https://github.com/elastic/elasticsearch-php/issues/989 - but for 6.8.x function missing all type hinting

    opened by mamsincl 1
Releases(v7.13.1)
  • v7.13.1(Jun 15, 2021)

  • v7.13.0(May 25, 2021)

    This release is compatible with the latest Elasticsearch 7.13.0 released in 25th May 2021.

    It includes the following fixes and improvements:

    • (DOCS) Added the HTTP meta data section #1143
    • Added support for API Compatibility Header #1142
    • (DOCS) Added Helpers section to PHP book #1129
    • Added the API description in phpdoc section for each endpoint 9e05c81
    • Usage of PHPUnit 9 only + migrated xml configurations 038b5dd

    Added the following new APIs πŸŽ‰ (4 stable, 7 experimental, and 5 beta):

    Stable

    Experimental

    Beta

    API changes

    • Cat.nodes, added the include_unloaded_segments parameter (boolean). If set to true segment stats will include stats for segments that are not currently loaded into memory (Default = false).
    • Ml.deleteDataFrameAnalytics, this API is now stable, previosuly it was beta.
    • Ml.deleteTrainedModel, this API is now stable, previosuly it was beta.
    • Ml.explainDataFrameAnalytics, this API is now stable, previosuly it was beta.
    • Ml.getDataFrameAnalytics, this API is now stable, previosuly it was beta.
    • Ml.getDataFrameAnalyticsStats, this API is now stable, previosuly it was beta.
    • Ml.getTrainedModels, this API is now stable, previosuly it was beta.
    • Ml.getTrainedModelsStats, this API is now stable, previosuly it was beta.
    • Ml.putDataFrameAnalytics, this API is now stable, previosuly it was beta.
    • Ml.putTrainedModel, this API is now stable, previosuly it was beta.
    • Ml.startDataFrameAnalytics, this API is now stable, previosuly it was beta.
    • Ml.stopDataFrameAnalytics, this API is now stable, previosuly it was beta.
    • Ml.updateDataFrameAnalytics, this API is now stable, previosuly it was beta.
    • Nodes.stats, added include_unloaded_segments parameter (boolean). If set to true segment stats will include stats for segments that are not currently loaded into memory (Default = false).
    • Snapshot.get, added index_details parameter (boolean). Whether to include details of each index in the snapshot, if those details are available. Defaults to false.
    • TextStructure.findStructure, this API is now stable, previosuly it was experimental.
    Source code(tar.gz)
    Source code(zip)
  • v7.12.0(Mar 23, 2021)

    This release is compatible with the latest Elasticsearch 7.12.0 released in 23th March 2021.

    It includes the following fixes and improvements:

    • 136d5b9 Removed cpliakas/git-wrapper in favor of symplify/git-wrapper
    • 0d81be1 Fixed warning header as array in YAML tests generator
    • f69d96f Refactored TEST_SUITE with free, platinum + removed old YamlRunnerTest

    Added the following new APIs πŸŽ‰ (5 stable, 1 experimental):

    Stable

    Experimental

    API changes

    • Autoscaling.deleteAutoscalingPolicy, this API is now stable, previosuly it was experimental
    • Autoscaling.getAutoscalingPolicy, this API is now stable, previosuly it was experimental
    • Autoscaling.putAutoscalingPolicy, this API is now stable, previosuly it was experimental
    • Indices.close, added documentation for the wait_for_active_shards parameter: set to index-setting to wait according to the index setting index.write.wait_for_active_shards, or all to wait for all shards, or an integer. Defaults to 0
    • Ml.findFileStructure, this API has been removed, previosuly it was experimental
    • Search, added the min_compatible_shard_node parameter (string). The minimum compatible version that all shards involved in search should have for this request to be successful
    • SearchableSnapshots.mount, added the storage parameter (string). Selects the kind of local storage used to accelerate searches. Experimental, and defaults to full_copy
    • SearchableSnapshots.stats, added the level parameter (enum). Return stats aggregated at cluster, index or shard level (Options = cluster,indices,shards) (Default = indices)
    Source code(tar.gz)
    Source code(zip)
  • v6.8.1(Mar 22, 2021)

    • Fixed missing class aliases in 6.8.0 (https://github.com/elastic/elasticsearch-php/pull/1114)
    • Backported #1066: fix #1058 using object instead of array in onFailure event (https://github.com/elastic/elasticsearch-php/pull/1109)
    Source code(tar.gz)
    Source code(zip)
  • v6.8.0(Mar 1, 2021)

    The 6.8.0 release includes all the Elasticsearch endpoints (including XPack). We tested using the latest Elasticsearch 6.8.14 released in February 10, 2021.

    NOTE: This release requires PHP 7.3+. It supports also PHP 8.

    This release includes the following updates:

    • Added the XPack endpoints
    • Removed Travis CI in favor of Github Action

    and backported the following features/PRs:

    • Added X-Opaque-Id header (https://github.com/elastic/elasticsearch-php/pull/952)
    • Added X-Elastic-Client-Meta header (https://github.com/elastic/elasticsearch-php/pull/1089)
    • Added the license header (https://github.com/elastic/elasticsearch-php/commit/0ff5fb98745a511118df5b1a68ca54d892b08ee3)
    • Support of PHP 8 (https://github.com/elastic/elasticsearch-php/pull/1095 and https://github.com/elastic/elasticsearch-php/pull/1063)
    • Replace array_walk with array_map in Connection::getURI (https://github.com/elastic/elasticsearch-php/pull/1075)
    • Fix for #1064 reset custom headers (https://github.com/elastic/elasticsearch-php/pull/1065)
    • Replace guzzlehttp/ringphp with ezimuel/ringphp (https://github.com/elastic/elasticsearch-php/pull/1102)
    Source code(tar.gz)
    Source code(zip)
  • v7.11.0(Feb 11, 2021)

    This release is compatible with the latest Elasticsearch 7.11.0 released in 10th February 2021. This is the first release to be compatible with PHP 8.

    It includes the following fixes and improvements:

    • #1089 Added the X-Elastic-Client-Meta header which is used by Elastic Cloud and can be disabled with ClientBuilder::setElasticMetaHeader(false)
    • #1075 Replaced array_walk with array_map in Connection::getURI for PHP 8 compatibility
    • #1069 Remove unnecessary InvalidArgumentExceptions
    • #1063 Introducing PHP 8 compatibility
    • #1062 Replace Sami by Doctum and fix .gitignore

    Added the following new APIs πŸŽ‰ (6 stable, 1 experimental):

    Stable

    Experimental

    API changes

    • Cat.tasks, the parameters node_id and parent_task has been changed in nodes and parent_task_id
    • Cluster.deleteComponentTemplate, this API has become STABLE, it was EXPERIMENTAL before
    • Cluster.existsComponentTemplate, this API has become STABLE, it was EXPERIMENTAL before
    • Cluster.getComponentTemplate, this API has become STABLE, it was EXPERIMENTAL before
    • Cluster.putComponentTemplate, this API has become STABLE, it was EXPERIMENTAL before
    • Indices.deleteIndexTemplate, this API has become STABLE, it was EXPERIMENTAL before
    • Indices.existsIndexTemplate, this API has become STABLE, it was EXPERIMENTAL before
    • Indices.getIndexTemplate, this API has become STABLE, it was EXPERIMENTAL before
    • Indices.putIndexTemplate, this API has become STABLE, it was EXPERIMENTAL before
    • Indices.simulateIndexTemplate, this API has become STABLE, it was EXPERIMENTAL before
    • Indices.simulateTemplate, this API has become STABLE, it was EXPERIMENTAL before
    • DataFrameTransformDeprecated.getTransform (BETA API), added the exclude_generated parameter: (boolean) Omits generated fields. Allows transform configurations to be easily copied between clusters and within the same cluster (Default = false)
    • Eql.delete, this API has become STABLE, it was BETA before
    • Eql.get, this API has become STABLE, it was BETA before
    • Eql.search, this API has become STABLE, it was BETA before
    • Indices.deleteDataStream, added expand_wildcards parameter: (enum) Whether wildcard expressions should get expanded to open or closed indices (default: open) (Options = open,closed,hidden,none,all) (Default = open)
    • Indices.getDataStream, added expand_wildcards parameter: (enum) Whether wildcard expressions should get expanded to open or closed indices (default: open) (Options = open,closed,hidden,none,all) (Default = open)
    • Ml.deleteDataFrameAnalytics, this API has become BETA, it was EXPERIMENTAL before
    • Ml.deleteTrainedModel, this API has become BETA, it was EXPERIMENTAL before
    • Ml.explainDataFrameAnalytics, this API has become BETA, it was EXPERIMENTAL before
    • Ml.getDataFrameAnalytics, this API has become BETA, it was EXPERIMENTAL before
    • Ml.getDatafeeds, added the exclude_generated parameter: (boolean) Omits fields that are illegal to set on data frame analytics PUT (Default = false)
    • Ml.getJobs, added the exclude_generated parameter: (boolean) Omits fields that are illegal to set on job PUT (Default = false)
    • Ml.getTrainedModels, this API has become BETA, it was EXPERIMENTAL before. Added the exclude_generated paremeter: (boolean) Omits fields that are illegal to set on model PUT (Default = false). Removed the for_export parameter
    • Ml.getTrainedModelsStats, this API has become BETA, it was EXPERIMENTAL before
    • Ml.putDataFrameAnalytics, this API has become BETA, it was EXPERIMENTAL before
    • Ml.putTrainedModel, this API has become BETA, it was EXPERIMENTAL before
    • Ml.startDataFrameAnalytics, this API has become BETA, it was EXPERIMENTAL before
    • Ml.stopDataFrameAnalytics, this API has become BETA, it was EXPERIMENTAL before
    • Ml.updateDataFrameAnalytics, this API has become BETA, it was EXPERIMENTAL before
    • Transform.getTransform, added the exclude_generated parameter: (boolean) Omits fields that are illegal to set on transform PUT (Default = false)
    Source code(tar.gz)
    Source code(zip)
  • v7.10.0(Nov 11, 2020)

    This release is compatible with the latest Elasticsearch 7.10.0 released in 11th November 2020.

    It includes the following fixes and improvements:

    • Fixed ClientBuilder::fromConfig allowing multiple function parameters (e.g. setApiKey) #1076
    • Refactored the YAML tests using generated PHPUnit code 85fadc2

    Added the following new APIs πŸŽ‰:

    Stable

    API changes

    • Bulk: added the require_alias parameter = (boolean) Sets require_alias for all incoming documents. Defaults to unset (false).

    • Index: added the require_alias parameter = (boolean) When true, requires destination to be an alias. Default is false.

    • Update: added the require_alias parameter = (boolean) When true, requires destination is an alias. Default is false.

    • Cat.mlDatafeeds: added the allow_no_match parameter = (boolean) Whether to ignore if a wildcard expression matches no datafeeds. This includes _all string or when no datafeeds have been specified.

    • Cat.mlJobs: added the allow_no_match parameter = (boolean) Whether to ignore if a wildcard expression matches no datafeeds. This includes _all string or when no datafeeds have been specified.

    • Ml.closeJob: added the allow_no_match parameter = (boolean) Whether to ignore if a wildcard expression matches no jobs. This includes _all string or when no jobs have been specified.

    • Ml.getDatafeeds: added the allow_no_match parameter = (boolean) Whether to ignore if a wildcard expression matches no datafeeds. This includes _all string or when no datafeeds have been specified.

    • Ml.getJobStats: added the allow_no_match parameter = (boolean) Whether to ignore if a wildcard expression matches no jobs. This includes _all string or when no jobs have been specified.

    • Ml.getJobs: added the allow_no_match parameter = (boolean) Whether to ignore if a wildcard expression matches no jobs. This includes _all string or when no jobs have been specified.

    • Ml.getOverallBuckets: added the allow_no_match parameter = (boolean) Whether to ignore if a wildcard expression matches no jobs. This includes _all string or when no jobs have been specified.

    • Ml.getTrainedModels (EXPERIMENTAL API): added the include parameter = (string) A comma-separate list of fields to optionally include. Valid options are definition and total_feature_importance. Default is none.

    • Ml.stopDatafeed: added the allow_no_match parameter = (boolean) Whether to ignore if a wildcard expression matches no datafeeds. This includes _all string or when no datafeeds have been specified.

    Source code(tar.gz)
    Source code(zip)
  • v7.9.1(Oct 6, 2020)

  • v7.9.0(Aug 18, 2020)

    This release is compatible with the latest Elasticsearch 7.9.0 released in 18th August 2020.

    It includes the following fixes:

    • Moved scroll_id into body for search operations in the documentation #1052
    • Fixed PHP 7.4 preloading feature for autoload.php #1051
    • Improved message of JSON errors using json_last_error_msg() #1045
    • Make ClientBuilder override possible, using static instead of self #1036

    Added the following new APIs πŸŽ‰:

    Stable

    Beta

    Beta APIs are on track to become stable and permanent features. Use them with caution because it is possible that breaking changes are made to these APIs in a minor version.

    Experimental

    Experimental APIs are just that - an experiment. An experimental API might have breaking changes in any future version, or it might even be removed entirely.

    API changes

    • Indices.putMapping: added the write_index_only parameter = (boolean) When true, applies mappings only to the write index of an alias or data stream (Default = false)

    • Ml.deleteExpiredData: added the following parameters:

      • job_id (string) The ID of the job(s) to perform expired data hygiene for
      • requests_per_second (number) The desired requests per second for the deletion processes
      • timeout (time) How long can the underlying delete processes run until they are canceled
      • body (array) deleting expired data parameters
    • Ml.forecast: added the parameter max_model_memory (string) The max memory able to be used by the forecast. Default is 20mb.

    • Ml.getCategories: added the parameter partition_field_value (string) Specifies the partition to retrieve categories for. This is optional, and should never be used for jobs where per-partition categorization is disabled

    • Ml.getTrainedModels: added the parameter for_export (boolean) Omits fields that are illegal to set on model PUT (Default = false)

    • Xpack.info: added the parameter accept_enterprise (boolean) If an enterprise license is installed, return the type and mode as 'enterprise' (default: false)

    • Indices.deleteDataStream: changed the name parameter from string to list (a comma-separated list of data streams to delete; use * to delete all data streams)

    • Indices.getDataStream (name changed from getDataStreams): changed the name parameter from string to list (a comma-separated list of data streams to get; use * to get all data streams)

    Source code(tar.gz)
    Source code(zip)
  • v7.4.2(Aug 11, 2020)

    This release fixes https://github.com/elastic/elasticsearch-php/issues/1048 and #1017 issues with indexing failure for item IDs that contain slashes.

    Source code(tar.gz)
    Source code(zip)
  • v7.8.0(Jun 18, 2020)

    This release is compatible with the latest Elasticsearch 7.8.0 released in 18th June 2020.

    It includes the following new endpoints πŸŽ‰:

    and the following changes:

    • Indices.getDataStreams, changed the name parameter type to string, instead of list
    • Tasks.cancel, added wait_for_completion boolean parameter. Can be use to block the request until the cancellation of the task and its descendant tasks is completed. Defaults to false
    • Ml.deleteExpiredData, added body containing deleting expired data parameters
    • Ml.deleteDataFrameAnalytics, added timeout controls the time to wait until a job is deleted. Defaults to 1 minute

    Elasticsearch 7.8.0 includes also some experimental APIs. Pleas note, an experimental API might have breaking changes in any future version, or it might even be removed entirely.

    and the new Searchable snapshot namespace with the following experimental APIs:

    Source code(tar.gz)
    Source code(zip)
  • v7.7.0(May 13, 2020)

    This release is compatible with the latest Elasticsearch 7.7.0 released in 13th May 2020.

    It contains the following new features πŸŽ‰:

    • Added JUnit log for PHPUnit 88b7e1c
    • Added the XPack endpoints 763d91a

    and fixes :

    • Removed setId() into endpoints, fixed util/GenerateEndpoints.php #1026
    • Fixes JsonErrorException with code instead of message #1022
    • Better exception message for Could not parse URI #1016

    XPack endpoints πŸŽ‰

    In this release we included all the XPack endpoints, that was previously managed in a separate repository elastic/elasticsearch-x-pack-php (not updated since Elasticsearch 5.0 :sweat:).

    These APIs are related to:

    New APIs added to Elasticsearch 7.7.0

    Elasticsearch 7.7.0 includes the following new APIs:

    Cluster

    AsyncSearch

    Autoscaling

    Cat

    Eql

    Machine Learning (ML)

    Experimental APIs:

    Elasticsearch 7.7.0 includes also some experimental APIs. Pleas note, an experimental API might have breaking changes in any future version, or it might even be removed entirely.

    Source code(tar.gz)
    Source code(zip)
  • v7.5.2(Feb 17, 2020)

  • v7.6.1(Feb 14, 2020)

  • v7.6.0(Feb 14, 2020)

    • Generated the new endpoints for Elasticsearch 7.6.0 be31f31

    The following fix are also included in elasticsearch-php 7.5.1:

    • Fixes port missing in log #925 75e0888
    • Fixes #993 adding ClientBuilder::includePortInHostHeader() for including port in the Host header. By default, the port is not included. #997
    • Replace abandoned packages: ringphp, streams and phpstan-shim #996
    • Fixed gzip compression when setting Cloud Id #986

    For more information about Elasticsearch 7.6 release please read the following page: https://www.elastic.co/blog/elasticsearch-7-6-0-released

    Source code(tar.gz)
    Source code(zip)
  • v7.5.1(Feb 14, 2020)

    • Fixes port missing in log #925 commit 75e0888
    • Fixes #993 adding ClientBuilder::includePortInHostHeader() for including port in the Host header. By default, the port is not included. #997
    • Replace abandoned packages: ringphp, streams and phpstan-shim #996
    • Fixed gzip compression when setting Cloud Id #986
    Source code(tar.gz)
    Source code(zip)
  • v7.5.0(Dec 19, 2019)

    • Code generation of endpoint classes using the API specification of Elasticsearch 7.5.0 commit ec0e0aa
    • Fixed Client::extractArgument iterable casting to array; this allows passing a Traversable body for some endpoints (e.g. Bulk, Msearch, MsearchTemplate) #983
    • Fixed the Response Exception if the reason field is null #980
    • Added support for PHP 7.4 #976
    Source code(tar.gz)
    Source code(zip)
  • v7.4.1(Nov 26, 2019)

    This release solves the BC break issues introduced in 7.4.0.

    • We added the suppress operator @ for the deprecation messages @trigger_error(). With this approach we don't break existing application that convert PHP errors in Exception (e.g. using Laravel with issue https://github.com/babenkoivan/scout-elasticsearch-driver/issues/297). Using the @ operator is still possible to intercept the deprecation message using a custom error handler. #973
    • Add missing leading slash in the URL of put mapping endpoint #970
    • Fix pre 7.2 endpoint class name with aliases + reapply fix #947. This PR solved the unexpected BC break introduce in 7.4.0 with the code generation tool #968
    Source code(tar.gz)
    Source code(zip)
  • v7.4.0(Nov 19, 2019)

    BC breaks:

    This version introduces some potential BC breaks:

    • Using a deprecated parameter is notified triggering a E_USER_DEPRECATED error (e.g. using the type parameter will generate a Specifying types in urls has been deprecated deprecation message).
    • When delete with an empty id a Missing404Exception exception is thrown. Previously it was a InvalidArgumentException.

    Changelog:

    • Added the code generation for endpoints and namespaces based on the REST API specification of Elasticsearch. This tool is available in util/GenerateEndpoints.php #966
    • Fixed the asciidoc endpoints documentation based on the code generation using Sami project #966
    • All the experimental and beta APIs are now signed with a @note tag in the phpdoc section (e.g. $client->rankEval()). For more information read the experimental and beta APIs section in the documentation #966
    • Removed AlreadyExpiredException since it has been removed from Elasticsearch with https://github.com/elastic/elasticsearch/pull/24857 #954
    Source code(tar.gz)
    Source code(zip)
  • v7.3.0(Sep 30, 2019)

    Support for Elasticsearch v7.3.

    • Added support for simplified access to the X-Opaque-Id header #952
    • Added the HTTP port in the log messages #950
    • Fixed hostname with underscore (ClientBuilder::prependMissingScheme) #949
    • Removed unused Monolog classes in ClientBuilder #948

    Note: this release is also compatible with Elasticsearch v7.2.

    Source code(tar.gz)
    Source code(zip)
  • v7.2.2(Aug 30, 2019)

  • v7.2.1(Aug 27, 2019)

    • Reintroduced Elasticsearch\Namespaces\IndicesNamespace::getAliases() as proxy to IndicesNamespace::getAlias() to prevent BC breaks. The getAliases() is marked as deprecated and it will be removed from elasticsearch-php 8.0 #943

    Docs

    • Fixed missing put mapping code snippet in code examples #938
    Source code(tar.gz)
    Source code(zip)
  • v7.2.0(Aug 26, 2019)

    • Updated the API endpoints for working with Elasticsearch 7.2.0 [27d721b]:

      • added wait_for_active_shards parameter to indices.close API;
      • added expand_wildcards parameter to cluster.health API;
      • added include_unloaded_segments,expand_wildcards,forbid_closed_indicesparameters toindices.stats` API.
    • Updated the phpdoc parameters for all the API endpoints [27d721b]

    • Improved the Travis CI speed using cache feature with composer #929

    • Fixed php_uname() usage checking if it is disabled #927

    • Added support of Elastic Cloud ID and API key authentication #923

    BC break

    • IndicesNamespace::getAliases() has been changed in favor of IndicesNamespace::getAlias(). This because the endpoints are generated from the API specification of Elasticsearch and the name is indices.get_alias (see here).

    NOTE: we released 7.2.1 that reintroduces the getAliases() function as proxy to getAlias(), please use this version to avoid BC breaks.

    Source code(tar.gz)
    Source code(zip)
  • v6.7.2(Jul 19, 2019)

  • v6.5.1(Jul 19, 2019)

    • Fix #846 choosing GET and POST in endpoints based on body [acbc76d0]
    • Fix #843 adding wait_for_active_shards and pipeline in UpdateByQuery [acbc76d0]
    • Fixed missing ScriptsPainlessExecute endpoint, since ES 6.3 [acbc76d0]
    • Fixed missing RankEval endpoint, since ES 6.2 [acbc76d0]
    • Added User-Agent header equal to elasticsearch-php/6.5.1 (metadata-values) [acbc76d0]

    NOTE: this release can be used with Elasticsearch from 6.0 to 6.5 included.

    Source code(tar.gz)
    Source code(zip)
  • v5.5.0(Jul 18, 2019)

  • v7.1.1(Jul 12, 2019)

    • Fixed ClientBuilder::setSSLVerification() to accept string or boolean #917
    • Fix type hinting for setBody in Elasticsearch\Endpoints\Ingest\Pipeline\Put #913

    NOTE: this release can be used with Elasticsearch 7.0 and 7.1.

    Source code(tar.gz)
    Source code(zip)
  • v7.1.0(Jul 9, 2019)

    • Added warning log for Elasticsearch response containing the Warning header #911
    • Fixed #838 hosting company is blocking ports because of YamlRunnerTest.php #844
    • Specialized inheritance of NoNodesAvailableException to extend ServerErrorResponseException instead of the generic \Exception #607
    • Fixed scroll TTL is extracted but not set as a body param #907

    Testing

    • Improved the speed of integration tests removing snapshots delete from YamlRunnerTest::clean #911
    • Reduced the number of skipping YAML integration tests from 20 to 6 #911

    Docs

    • Documentation updated for Elasticsearch 7 #904

    NOTE: this release can be used with Elasticsearch 7.0 and 7.1.

    Source code(tar.gz)
    Source code(zip)
  • v7.0.2(Jul 1, 2019)

  • v7.0.1(Jun 17, 2019)

Maps Laravel Eloquent models to Elasticsearch types

Elasticquent Elasticsearch for Eloquent Laravel Models Elasticquent makes working with Elasticsearch and Eloquent models easier by mapping them to Ela

Elasticquent 1.2k Jun 14, 2021
Store and retrieve objects from Algolia or Elasticsearch

Store and retrieve objects from a search index This is an opinionated Laravel 5.1 package to store and retrieve objects from a search index. Currently

Spatie 436 Jun 1, 2021
Plastic is an Elasticsearch ODM and mapper for Laravel. It renders the developer experience more enjoyable while using Elasticsearch, by providing a fluent syntax for mapping, querying, and storing eloquent models.

Plastic is an Elasticsearch ODM and mapper for Laravel. It renders the developer experience more enjoyable while using Elasticsearch, by providing a f

Sleiman Sleiman 494 May 4, 2021
Elastica is a PHP client for elasticsearch

Elastica: elasticsearch PHP Client All documentation for Elastica can be found under Elastica.io. If you have questions, don't hesitate to ask them on

Nicolas Ruflin 2.1k Jun 14, 2021
MeiliSearch PHP is the MeiliSearch API client for PHP developers.

MeiliSearch PHP is the MeiliSearch API client for PHP developers. ⚑ The MeiliSearch API client written for PHP ??

MeiliSearch 148 Jun 13, 2021
A search package for Laravel 5.

Search Package for Laravel 5 This package provides a unified API across a variety of different full text search services. It currently supports driver

Mark Manos 354 Jun 9, 2021
[Deprecated] We now recommend using Laravel Scout, see =>

[DEPRECATED] Algolia Search API Client for Laravel Algolia Search is a hosted full-text, numerical, and faceted search engine capable of delivering re

Algolia 243 May 7, 2021
PHP Solr client library

Solarium PHP Solr Client Library What is Solarium? Solarium is a PHP Solr client library that accurately models Solr concepts. Where many other Solr l

Solarium PHP library organization 859 Jun 11, 2021
Laravel Scout provides a driver based solution to searching your Eloquent models.

Introduction Laravel Scout provides a simple, driver-based solution for adding full-text search to your Eloquent models. Once Scout is installed and c

The Laravel Framework 1.1k Jun 13, 2021
Sphinx Search library provides SphinxQL indexing and searching features

Sphinx Search Sphinx Search library provides SphinxQL indexing and searching features. Introduction Installation Configuration (simple) Usage Search I

Ripa Club 62 May 4, 2021
A fully featured full text search engine written in PHP

TNTSearch TNTSearch is a full-text search (FTS) engine written entirely in PHP. A simple configuration allows you to add an amazing search experience

TNT Studio 2.4k Jun 19, 2021
Unmaintained: Laravel Searchy makes user driven searching easy with fuzzy search, basic string matching and more to come!

!! UNMAINTAINED !! This package is no longer maintained Please see Issue #117 Here are some links to alternatives that you may be able to use (I do no

Tom Lingham 527 May 25, 2021
SphinxQL Query Builder generates SphinxQL, a SQL dialect, which is used to query the Sphinx search engine. (Composer Package)

Query Builder for SphinxQL About This is a SphinxQL Query Builder used to work with SphinxQL, a SQL dialect used with the Sphinx search engine and it'

FoolCode 305 May 13, 2021
Driver for Laravel Scout search package based on https://github.com/teamtnt/tntsearch

TNTSearch Driver for Laravel Scout - Laravel 5.3 - 8.0 This package makes it easy to add full text search support to your models with Laravel 5.3 to 8

TNT Studio 941 Jun 8, 2021