定制 salamtam/elasticsearch-loop-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

salamtam/elasticsearch-loop-php

Composer 安装命令:

composer require salamtam/elasticsearch-loop-php

包简介

for Looping data from Elasticsearch

README 文档

README

for Looping data from Elasticsearch

#Usage

##Initial setup

  1. Install composer. curl -s http://getcomposer.org/installer | php

  2. Create composer.json containing:

{
    "require" : {
        "salamtam/elasticsearch-loop-php" : "^1.4"
    }
}
  1. Run ./composer.phar install

  2. Keep up-to-date: ./composer.phar update

##Example 1

Query with URL

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

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);

统计信息

  • 总下载量: 6.46k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-06-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固