Tony Messias has written a nice tutorial about integrating Elasticsearch with our Laravel application.

Searching is an important part of many applications, and it is most of the time treated as a simple task. “Just query using LIKE and you’re good to go”. Well, while the LIKE clause can be handy sometimes we have to do it in a better way. After researching for a while I found a few good resources on the subject. The most attractive one is Elasticsearch. Yes, you can go far with full-text search and other searching techniques, however Elasticsearch is very handy and comes with a variety of useful functionalities. I’m going to cover the basics here and link more resources at the bottom, so you can dig further.

What is Elasticsearch?

From the website:

Elasticsearch is a flexible and powerful open source, distributed, real-time search and analytics engine. Architected from the ground up for use in distributed environments where reliability and scalability are must haves, Elasticsearch gives you the ability to move easily beyond simple full-text search. Through its robust set of APIs and query DSLs, plus clients for the most popular programming languages, Elasticsearch delivers on the near limitless promises of search technology.

In other words: you can use Elasticsearch for logging (see the ELK stack) and for searching. This article aims to explain the usage for searching, maybe I’ll cover the logging and analytics in another article.

Basics about Elasticsearch (with a SQL comparison)

So, in SQL we have a database with tables, which is like the structure of the data, and rows, which are the data itself (basically the values for the table structure). Translating this knowledge to Elasticsearch we have: indexes (like the database itself or schemas in some DBMS) and inside the indexes, we have types (l