PHPackages                             fundmetric/elasticquent - 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. [Database &amp; ORM](/categories/database)
4. /
5. fundmetric/elasticquent

ActiveLibrary[Database &amp; ORM](/categories/database)

fundmetric/elasticquent
=======================

Map Larvel Eloquent models to Elasticsearch types.

01.4k↓16.7%PHPCI failing

Since Nov 14Pushed 5y ago2 watchersCompare

[ Source](https://github.com/Fundmetric/Elasticquent)[ Packagist](https://packagist.org/packages/fundmetric/elasticquent)[ RSS](/packages/fundmetric-elasticquent/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (0)

Elasticquent Beta
=================

[](#elasticquent-beta)

*Elasticsearch for Eloquent Laravel Models*

Elasticquent makes working with [Elasticsearch](http://www.elasticsearch.org/) and [Eloquent](http://laravel.com/docs/eloquent) models easier by mapping them to Elasticsearch types. You can use the default settings or define how Elasticsearch should index and search your Eloquent models right in the model.

Elasticquent uses the [official Elasticsearch PHP API](https://github.com/elasticsearch/elasticsearch-php). To get started, you should have a basic knowledge of how Elasticsearch works (indexes, types, mappings, etc). This is meant for use with Elasticsearch 1.x.

Contents
--------

[](#contents)

- [Overview](#overview)
    - [How Elasticquent Works](#how-elasticquent-works)
- [Setup](#setup)
    - [Elasticsearch Configuration](#elasticsearch-configuration)
    - [Indexes and Mapping](#indexes-and-mapping)
    - [Setting a Custom Index Name](#setting-a-custom-index-name)
    - [Setting a Custom Type Name](#setting-a-custom-type-name)
- [Indexing Documents](#indexing-documents)
- [Searching](#searching)
    - [Search Collections](#search-collections)
    - [Search Collection Documents](#search-collection-documents)
    - [Using the Search Collection Outside Elasticquent](#using-the-search-collection-outside-wlasticquent)
- [More Options](#more-options)
    - [Document Ids](#document-ids)
    - [Document Data](#document-data)
    - [Using Elasticquent With Custom Collections](#using-elasticquetn-with-custom-collections)
- [Roadmap](#roadmap)

Overview
--------

[](#overview)

Elasticquent allows you take an Eloquent model and easily index and search its contents in Elasticsearch.

```
$books = Book::where('id', '
