Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

outboundexplorer's avatar

The more i read on elasticsearch, the more excited i am getting. My first idea for using this is to carry out full text searches for a blog, i'm thinking of having the data saved to MySQL and also inserted into elasticsearch at the same time. Then when a user carries out a search, laravel will search the elasticsearch index, find the relevant id for the matching data and then ask MySQL to serve the data. Anyone, had any experience with this or better suggestions.

I have been looking for more information and here are some cool links that i have found so far:

1) elasticsearch/elasticsearch (composer package) https://packagist.org/packages/elasticsearch/elasticsearch

2) elasticsearch/elasticsearch-php (low-level client for PHP) https://github.com/elasticsearch/elasticsearch-php

3) elasticsearch - the definitive guide (official book -- free online) http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/index.html

I currently have this up and running with laravel/homestead 2.1. However, i must admit that i used the older Vagrantfile from 1.0 to get this up and running. I just found it a lot easier to manipulate in order to install other bash scripts and make other settings. I also could not figure out how to run provisioning with the homestead command line. I still like my vagrant commands.

keogh's avatar

Hopefully enough interest has been shown in this thread now that Jeff might knock up a video (or series :p) on it some day?

keogh's avatar

Also like to point out that I have successfully integrated Elasticsearch in to the latest Laravel project I have done and it is head and shoulders above Solr. Really was a breeze to use and works beautifully, but definitely would love to see how Jeff goes about it.

So really the subject of this thread is now "Elasticsearch with Laravel"

1 like
opb's avatar

We're currently using a combination of Elasticsearch, Mongo and Redis for some backend processing of data and indexing for searches via a Laravel frontend. We used to hook Laravel directly into ES, but as everything got bigger the whole ES backend has been rewritten in python, and it presents a simple API which we use in Laravel to make search requests.

The worst thing about ES is easily the documentation. It's fine for really simple requests, but as soon a you do anything vaguely complicated (eg, custom scoring) it becomes a lot less straightforward.

A series on this would be good, but the cynic in me says it's not going to happen unless there is a direct need for ES functionality at Laracasts.

3 likes
felixs's avatar

Would love to see a series about ElasticSearch integration +1

andriusbartulis's avatar

I am using ElasticSearch with Laravel using the ElasticSearch PHP extension. Everything works great.

It would be awesome to see a series on ElasticSearch integration, especially with focus on advanced searching (geospatial, weighted) and good software design in regards to the search component of the application.

joselara's avatar

+1 for some more advance tutorials at Laracast.

rapliandras's avatar

I already use elasticsearch with lara5, but since it's not laravel stuff, I don't think it's ever gonna appear here.

Lordwhizy's avatar

+1 For Elasticsearch and/or Solar (Preferably Elasticsearch)

olimorris's avatar

It's funny how I see this request pop up every now and again...Man would I kill to see a Laracasts for ElasticSearch!

opb's avatar

I don't think we're going to see this ever guys. Advanced/niche topics are severely neglected here, which is a shame, but I guess the site is catering to the majority of its audience. I got super excited the other day when JW tweeted that he was going to take a look at React, thinking we'd get a nice slice of php async and event loop stuff. Sadness arrived only a few seconds later when it turned out to be a JS framework, and not react-php :(

fideloper's avatar

I'll be doing these videos on serversforhackers.com, starting with a single instance (like, how I'm using it for serversforhackers.com :P) and then using multiple ES servers (clustering).

Meanwhile, you can check out my Ansible role for elasticsearch (good for a single instance, not clustering) which shows installing, creating an index and creating a mapping for that index to be used with the SFH database data.

2 likes

Please or to participate in this conversation.