PHPackages                             leslie-xy/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. [Search &amp; Filtering](/categories/search)
4. /
5. leslie-xy/elasticsearch

ActiveLibrary[Search &amp; Filtering](/categories/search)

leslie-xy/elasticsearch
=======================

elasticsearc模型包

05PHP

Since May 18Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Leslie-Xy/elasticsearch)[ Packagist](https://packagist.org/packages/leslie-xy/elasticsearch)[ RSS](/packages/leslie-xy-elasticsearch/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

use Leslie\\elasticsearch\\Repository\\ElasticSearch\\ElasticSearchModel;

$this-&gt;model = with(new ElasticSearchModel($this-&gt;index, $this-&gt;type));

get()
-----

[](#get)

$sessionData = $this-&gt;model-&gt;get();

where()
-------

[](#where)

$this-&gt;model-&gt;where\['query'\]\['bool'\]\['filter'\]\[\] = \['range' =&gt; \[$field =&gt; $data\]\]; $this-&gt;model-&gt;where\['query'\]\['bool'\]\['filter'\]\[\] = \['term' =&gt; \[$field =&gt; $data\]\]; $this-&gt;model-&gt;where\['query'\]\['bool'\]\['filter'\]\[\] = \['terms' =&gt; \[$field =&gt; $data\]\]; `script: Two-field computation where`
$this-&gt;model-&gt;where\['query'\]\['bool'\]\['filter'\]\[\] = \['script' =&gt; \['script' =&gt; \['inline' =&gt; "(doc\['start\_talking\_at\_es'\].value - doc\['created\_at\_es'\].value) &lt; 30", 'lang' =&gt; 'painless'\]\]\];

field()
-------

[](#field)

$this-&gt;model-&gt;field\['\_source'\] = \['includes' =&gt; $field\];

group()
-------

[](#group)

$this-&gt;model-&gt;group = \['aggs' =&gt; \[$aggsName =&gt; \['terms'=&gt; \['field' =&gt; $aggsName, 'size' =&gt; $size\]\]\]\]; if (!empty($aggsArr)){ $this-&gt;model-&gt;group\['aggs'\]\[$aggsName\]\['aggregations'\] = $aggsArr; }
`aggs原生`
$this-&gt;model-&gt;group\['aggs'\] = \['esim\_ids' =&gt; \['terms' =&gt; \['field' =&gt; 'esim\_id', 'size' =&gt; 10000, 'order' =&gt; \['max\_time' =&gt; 'desc'\]\], 'aggs' =&gt; \['max\_time' =&gt; \['max' =&gt; \['field' =&gt; 'create\_time'\]\]\]\]\];

paginate()
----------

[](#paginate)

$obuVideo\['list'\] = $this-&gt;model-&gt;paginate($page); $obuVideo\['page\_count'\] = $this-&gt;model-&gt;page\_count; $obuVideo\['page'\] = $page;

create()
--------

[](#create)

`插入数据`
$this-&gt;model-&gt;create($insertData, 'id');

saveModel()
-----------

[](#savemodel)

`修改数据`
$this-&gt;model-&gt;saveModel($updateData, 'id');

delete()
--------

[](#delete)

`删除数据`
$this-&gt;model-&gt;delete($deleteId);

createTable()
-------------

[](#createtable)

`创建索引`
$model = with(new ElasticSearchModel('saas', 'knowledge\_base')); $field = \[ 'id' =&gt; \['type' =&gt; 'integer'\], 'title' =&gt; \['type' =&gt; 'text'\], 'problem\_id' =&gt; \['type' =&gt; 'integer'\], 'content' =&gt; \['type' =&gt; 'text'\], 'engineer\_code' =&gt; \['type' =&gt; 'text'\], 'updated\_at' =&gt; \['type' =&gt; 'text'\], 'created\_at' =&gt; \['type' =&gt; 'text'\], \]; $model-&gt;createTable('saas', 'knowledge\_base', $field);

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity33

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/8654ad6511e31c4699bff89c58afb5f4a8d23a1b04ffff5d3243e6853f185076?d=identicon)[Leslie-Xy](/maintainers/Leslie-Xy)

---

Top Contributors

[![Leslie-Xy](https://avatars.githubusercontent.com/u/52194246?v=4)](https://github.com/Leslie-Xy "Leslie-Xy (2 commits)")

### Embed Badge

![Health badge](/badges/leslie-xy-elasticsearch/health.svg)

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

###  Alternatives

[ruflin/elastica

Elasticsearch Client

2.3k50.4M203](/packages/ruflin-elastica)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M65](/packages/opensearch-project-opensearch-php)[mailerlite/laravel-elasticsearch

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

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[massive/search-bundle

Massive Search Bundle

721.4M13](/packages/massive-search-bundle)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)[handcraftedinthealps/zendsearch

a general purpose text search engine written entirely in PHP 5

39921.0k35](/packages/handcraftedinthealps-zendsearch)

PHPackages © 2026

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