承接 bfansports/aws-elasticsearch-php-handler 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

bfansports/aws-elasticsearch-php-handler

Composer 安装命令:

composer require bfansports/aws-elasticsearch-php-handler

包简介

Small library to access Elasticsearch hosted by AWS.

README 文档

README

PHP Handler to connect to AWS ElasticSearch service.

Installation

Use composer to install. Simply add "sportarchive/aws-elasticsearch-php-handler": "dev-master" to your composer requirements and update.

Instructions

Use basic lucene query syntax to query for results. You can also supply a max count and sort order in the query.
$client = new ElasticsearchHandler(["https://yourawselasticsearchendpoint.aws-region.es.amazonaws.com:443"]);

$ESindex = "index_name";
$EStype = "object_type";
$query = "key:value AND foo:bar";
$count = 12;
$sort = "anotherkey:asc";

$results = $client->raw($ESindex, $query, $count, $sort, $EStype);

The count, sort, and type are not required. If they are not supplied, these values will default to:

$count = 10;
$sort = "";
$EStype = $ESindex;

The $results variable will be the raw data returned from the elasticsearch official php library, and includes a variety of metadata.

If you only need the source objects that were stored, use the convenience function query instead.
$results = $client->query($ESindex, $query, $count, $sort, $EStype);

The $results variable will now be an array containing the source objects for your query. Query simply parses the data before returning to make it easier to use.

If you wish to simply get the count for the total number of results, there is also a count function.
$client = new ElasticsearchHandler(["https://yourawselasticsearchendpoint.aws-region.es.amazonaws.com:443"]);

$ESindex = "index_name";
$EStype = "object_type";
$query = "key:value AND foo:bar";

$results = $client->raw($ESindex, $query, $EStype);

This function acts the same way as raw and query, but instead uses Elasticsearch's search_type:count so it does not actually retrieve or return the data.

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 5
  • Forks: 4
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2017-07-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固