Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Elasticsearch Query Builder Laravel Package

spatie/elasticsearch-query-builder

Lightweight fluent PHP query builder for Elasticsearch. Build and execute searches with an ergonomic Builder API: set index, add queries, aggregations, sorting, and filters, then run search() against the official Elasticsearch PHP client.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Search Functionality Expansion: Enables rapid development of advanced search features (fuzzy matching, aggregations, nested queries) without deep Elasticsearch expertise.
  • Roadmap Acceleration: Reduces time-to-market for search-heavy features (e.g., autocomplete, analytics dashboards) by abstracting query complexity.
  • Build vs. Buy: Avoids reinventing a query builder wheel; leverages Spatie’s battle-tested, MIT-licensed solution for cost-efficient scaling.
  • Use Cases:
    • E-commerce: Product search with filters, faceted navigation, and relevance tuning.
    • Content Platforms: Full-text search with synonyms, typo tolerance, and metadata aggregations.
    • Analytics: Pre-built aggregations (avg, max, min) for dashboards without custom Elasticsearch DSL.
    • Legacy System Modernization: Gradually migrate from SQL to Elasticsearch by reusing existing Laravel query patterns.

When to Consider This Package

  • Adopt When:
    • Your team needs fluent, Laravel-like syntax for Elasticsearch queries (familiar to PHP devs).
    • You require common aggregations/queries (e.g., Match, Terms, Range, Max) without deep Elasticsearch expertise.
    • You’re using Spatie’s elasticsearch-search-string-parser (synergistic integration).
    • Your search needs are 80% covered by standard use cases (e.g., no need for custom script scoring or rare query types).
  • Look Elsewhere If:
    • You need advanced Elasticsearch features (e.g., custom painless scripts, percolate queries, or geospatial complex queries).
    • Your team prefers raw Elasticsearch DSL for fine-grained control or performance tuning.
    • You’re building a search-as-a-service product requiring extensibility beyond Spatie’s scope.
    • Your stack isn’t PHP/Laravel (package is PHP-centric).

How to Pitch It (Stakeholders)

For Executives: "This package lets us ship Elasticsearch-powered search features 3x faster by abstracting complex queries into simple, Laravel-friendly methods. For example, adding fuzzy search or aggregations takes minutes instead of days. It’s a lightweight, MIT-licensed tool that reduces dev overhead while enabling scalable search—ideal for e-commerce filters, content discovery, or analytics dashboards. No vendor lock-in; we own the queries and can extend them as needed."

For Engineering: *"Spatie’s query builder gives us a fluent, type-safe API to construct Elasticsearch queries without writing raw JSON. Key benefits:

  • Productivity: Chain methods like Laravel’s query builder (e.g., ->addQuery(MatchQuery::create())).
  • Maintainability: Queries are self-documenting and version-controlled in PHP.
  • Flexibility: Supports aggregations, nested queries, and common filters out of the box.
  • Integration: Works seamlessly with Spatie’s search parser and Laravel’s ecosystem. Tradeoff: Limited to standard use cases, but extensible via PRs or custom query classes. Perfect for MVP-to-scale search features."*
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport