2017 © Pedro Peláez
 

vcs elasticsearch-loop-php

for Looping data from Elasticsearch

image

salamtam/elasticsearch-loop-php

for Looping data from Elasticsearch

  • Monday, March 27, 2017
  • by salamtam
  • Repository
  • 1 Watchers
  • 1 Stars
  • 487 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

elasticsearch-loop-php

for Looping data from Elasticsearch, (*1)

Usage

Initial setup

  1. Install composer. curl -s http://getcomposer.org/installer | php, (*2)

  2. Create composer.json containing:, (*3)

    {
      "require" : {
          "salamtam/elasticsearch-loop-php" : "^1.4"
      }
    }
    
  3. Run ./composer.phar install, (*4)

  4. Keep up-to-date: ./composer.phar update, (*5)

Example 1

Query with URL, (*6)

require_once __DIR__ . "/vendor/autoload.php";

use ElasticsearchLoopPHP\ElasticsearchLoop;

/* set connection elasticsearch */
$url = "localhost:9200";

/* set index name and type */
$params = [
    'index' => 'index_name',
    'type' => 'index_type',
    'body' => [
        'query' => [
            'match_all' => []
        ]
    ]
];

/* callback function */
$callback = function($response) {
    foreach ($response['hits']['hits'] as $item) {
          print_r($item);
    }
};

/* set query with url */
$client = new ElasticsearchLoop($url);

$client->getElasticsearch($params, $callback);

Example 2

Query with basic authentication, (*7)

require_once __DIR__ . "/vendor/autoload.php";

use ElasticsearchLoopPHP\ElasticsearchLoop;

/* set connection elasticsearch */
$user = "root";
$pass = "";
$host = "localhost";
$port = "9200";

/* set index name and type */
$params = [
    'index' => 'index_name',
    'type' => 'index_type',
    'body' => [
        'query' => [
            'match_all' => []
        ]
    ]
];

/* callback function */
$callback = function($response) {
    foreach ($response['hits']['hits'] as $item) {
        print_r($item);
    }
};

/* set query with host, user, pass and port */
$client = new ElasticsearchLoop($host, $user, $pass, $port);

$client->getElasticsearch($params, $callback);

The Versions

27/03 2017

dev-master

9999999-dev

for Looping data from Elasticsearch

  Sources   Download

The Requires

 

by Patchara Suwanwanakul

27/03 2017

v1.5

1.5.0.0

for Looping data from Elasticsearch

  Sources   Download

The Requires

 

by Patchara Suwanwanakul

27/03 2017

v1.6

1.6.0.0

for Looping data from Elasticsearch

  Sources   Download

The Requires

 

by Patchara Suwanwanakul

06/01 2017

v1.4

1.4.0.0

for Looping data from Elasticsearch

  Sources   Download

The Requires

 

by Patchara Suwanwanakul

18/10 2016

v1.3

1.3.0.0

for Looping data from Elasticsearch

  Sources   Download

The Requires

 

by Patchara Suwanwanakul

10/06 2016

v1.2

1.2.0.0

for Looping data from Elasticsearch

  Sources   Download

The Requires

 

by Patchara Suwanwanakul

10/06 2016

v1.1

1.1.0.0

for Looping data from Elasticsearch

  Sources   Download

The Requires

 

by Patchara Suwanwanakul

10/06 2016

v1.0

1.0.0.0

for Looping data from Elasticsearch

  Sources   Download

The Requires

 

by Patchara Suwanwanakul