Chapter 5. Searching—The Basic Tools
So far, we have learned how to use Elasticsearch as a simple NoSQL-style distributed document store. We can throw JSON documents at Elasticsearch and retrieve each one by ID. But the real power of Elasticsearch lies in its ability to make sense out of chaos — to turn Big Data into Big Information.
This is the reason that we use structured JSON documents, rather than amorphous blobs of data. Elasticsearch not only stores the document, but also indexes the content of the document in order to make it searchable.
Every field in a document is indexed and can be queried. And it’s not just that. During a single query, Elasticsearch can use all of these indices, to return results at breath-taking speed. That’s something that you could never consider doing with a traditional database.
A search can be any of the following:
-
A structured query on concrete fields like
gender
orage
, sorted by a field likejoin_date
, similar to the type of query that you could construct in SQL -
A full-text query, which finds all documents matching the search keywords, and returns them sorted by relevance
-
A combination of the two
While many searches will just work out of the box, to use Elasticsearch to its full potential, you need to understand three subjects:
- Mapping
-
How the data in each field is interpreted
- Analysis
-
How full text is processed to make it searchable
- Query DSL
-
The flexible, powerful query language used by Elasticsearch
Each of these is a big ...
Get Elasticsearch: The Definitive Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.