PHPackages                             tp5er/think-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. [API Development](/categories/api)
4. /
5. tp5er/think-elasticsearch

ActiveLibrary[API Development](/categories/api)

tp5er/think-elasticsearch
=========================

An easy way to use the official PHP ElasticSearch client in your thinkphp applications.

01.9kPHP

Since Jan 7Pushed 3y agoCompare

[ Source](https://github.com/pkg6/think-elasticsearch)[ Packagist](https://packagist.org/packages/tp5er/think-elasticsearch)[ RSS](/packages/tp5er-think-elasticsearch/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

安装
--

[](#安装)

```
composer require tp5er/think-elasticsearch
```

基本配置
----

[](#基本配置)

```
ELASTICSEARCH_HOST=localhost
ELASTICSEARCH_PORT=9200
ELASTICSEARCH_SCHEME=http
ELASTICSEARCH_USER=
ELASTICSEARCH_PASS=
```

常规使用
----

[](#常规使用)

> $data = \[ 'body' =&gt; \[ 'testField' =&gt; 'abc' \], 'index' =&gt; 'my\_index', 'type' =&gt; 'my\_type', 'id' =&gt; 'my\_id', \];
>
> $client = ClientBuilder::create()-&gt;build(); $return = $client-&gt;index($data);

您现在可以简单地替换最后两行：

```
$return = \tp5er\think\elasticsearch\Elasticsearch::index($data);
```

这将在默认连接上运行命令。 你可以运行一个命令 任何连接（参见 `defaultConnection` 设置和 `connections` 数组 配置文件）。

```
$return = \tp5er\think\elasticsearch\Elasticsearch::connection('connectionName')->index($data);
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/28b119a234a9963e2266b2b493c037b1d7f01d3e17a06a3ffe94481549efa47b?d=identicon)[1751212020](/maintainers/1751212020)

---

Top Contributors

[![chihqiang](https://avatars.githubusercontent.com/u/40115555?v=4)](https://github.com/chihqiang "chihqiang (1 commits)")

### Embed Badge

![Health badge](/badges/tp5er-think-elasticsearch/health.svg)

```
[![Health](https://phpackages.com/badges/tp5er-think-elasticsearch/health.svg)](https://phpackages.com/packages/tp5er-think-elasticsearch)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
