chapter eight

8 Introducing search

 

This chapter covers

  • Fundamentals of search
  • Types of search methods
  • Introduction to Query DSL
  • Common search features

It is now time to enter the world of search. So far, we've looked at priming Elasticsearch with data, and in the last chapter, we went over the mechanics of how the text fields are analyzed whereas non-text fields are not. Although we had a taste of searching through the data using a set of queries, we didn’t really explore the mechanics of searching or the nitty-gritty of the variants of search.To remedy that, this chapter and the following few chapters are dedicated to search.

Search is the core functionality of Elasticsearch that answers user queries efficiently and effectively. Once the data is indexed and available for search, users can ask various questions. For example, assuming our fictitious ElasticBooks online bookstore website search is powered by Elasticsearch, we can expect a multitude of queries originating from the clients. This can range from a simple query like finding a book based on a title search word or a complex query like searching books that match multiple criteria: a particular edition, published between a range of dates, hard bound with a review rating higher than 4.5 out of 5, price less than a certain amount, and so on. The UI may support various widgets such as drop downs, sliders, check boxes, and so forth to enable filtering the search even further.

8.1 Overview

8.2 How does search work?

8.3 Search fundamentals

8.3.1 Search endpoint

8.3.2 Query vs filter context

8.4 Movie sample data

8.5 Anatomy of a request and response

8.5.1 Search request

8.5.2 Search response

8.6 URI request search

8.6.1 Search movies by title

8.6.2 Search a specific movie

8.6.3 Additional parameters

8.6.4 Query DSL supports URI requests

8.7 Query DSL

8.7.1 Sample query

8.7.2 Query DSL for cURL

8.7.3 Query DSL for aggregations

8.7.4 Leaf and compound queries

8.8 Search features

8.8.1 Pagination

8.8.2 Highlighting