spameri/elastic-query 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

spameri/elastic-query

Composer 安装命令:

composer require spameri/elastic-query

包简介

Objects instead of arrays for querying to ElasticSearch.

README 文档

README

A PHP library that converts Elasticsearch query DSL into strongly-typed PHP objects. Instead of building queries as arrays, use type-safe classes that mirror the Elasticsearch documentation.

Features

  • Type-safe queries — full-text, term-level, compound, geo, nested, joining, vector (knn / sparse_vector / semantic), span queries, and rule queries
  • Aggregations — metric (min, max, avg, stats, weighted_avg, top_hits, top_metrics, t_test, geo_line, …), bucket (terms, histogram, date_histogram, range, filter, filters, composite with typed sources, ip_prefix, time_series, …), pipeline (cumulative_, bucket_, normalize, serial_diff, inference, …)
  • Function scoring — field value factor, weight, random, decay (gauss / linear / exp), script_score; score_mode + boost_mode
  • Sort — field, geo-distance, script-based, with nested sort (filter / max_children / recursive)
  • Highlight — per-field config (type, fragment_size, boundary scanner, encoder, fragmenter, highlight_query, matched_fields, no_match_size, order, phrase_limit, …)
  • Search options_source, track_total_hits, search_after, pit, collapse, rescore, suggest (term / phrase / completion), runtime_mappings, script_fields, docvalue_fields, stored_fields, terminate_after, timeout, profile, stats, ext
  • Response mapping — automatic mapping of Elasticsearch responses (including composite/named buckets, IP/date range buckets) to typed objects
  • Index mapping — index settings, analyzers, tokenizers, filters

See CHANGELOG.md for the full list of types and arguments added in v2.

Requirements

  • PHP 8.2 or higher

Installation

Install via Composer:

composer require spameri/elastic-query

Quick Start

use Spameri\ElasticQuery\ElasticQuery;
use Spameri\ElasticQuery\Query\ElasticMatch;
use Spameri\ElasticQuery\Query\Term;

// Create a query
$query = new ElasticQuery();

// Add a must query (AND condition)
$query->addMustQuery(new ElasticMatch('title', 'Elasticsearch'));

// Add a filter (cached, no scoring)
$query->addFilter(new Term('status', 'published'));

// Set pagination
$query->options()->changeSize(10);
$query->options()->changeFrom(0);

// Convert to array for Elasticsearch client
$body = $query->toArray();

Documentation

Learn more in the documentation:

License

MIT

spameri/elastic-query 适用场景与选型建议

spameri/elastic-query 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 44.76k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2017 年 12 月 05 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 spameri/elastic-query 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 spameri/elastic-query 我们能提供哪些服务?
定制开发 / 二次开发

基于 spameri/elastic-query 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2017-12-05