chapter ten

10 Full-text search

 

This chapter covers

  • Overview of full text queries
  • Working through match queries
  • Looking at match phrase, multi-match, and other queries
  • Looking at query strings and simple query string queries

In the last chapter, we looked at term-level searching, which is the mechanism that we use to search structured data. Although a structured data search is important, the power of modern search engines vests in an efficient and effective way to run when we search unstructured data. Elasticsearch is one such modern search engine that stands as a front runner in searching unstructured data with relevance.

Elasticsearch provides the capability to search unstructured data in the form of full text search queries. A full text search is all about relevancy: fetching the documents that are relevant to the user's search. For example, when searching for the word Java in an online bookstore, one shouldn't expect to receive details about the Indonesian island of Java or the wet pressed coffee grown on this island.

10.1  Overview

10.1.1 Precision

10.1.2 Recall

10.2  Sample data

10.3  Match all (match_all) queries

10.3.1 Building the match_all query

10.3.2 Short form of a match_all query

10.4  Match none (match_none) queries

10.5  Match queries

10.5.1 Format of a match query

10.5.2 Searching using a match query

10.5.3 Match query analysis

10.5.4 Searching multiple words

10.5.5 Matching at least a few words

10.5.6 Fixing typos using the keyword fuzziness

10.6  Match phrase (match_phrase) queries

10.6.1 Match phrase with the keyword slop

10.7  Match phrase prefix (match_phrase_prefix) queries

10.7.1 Match phrase prefix using slop

10.8  Multi-match (multi_match) queries

10.8.1 Best fields

10.8.2 Disjunction max (dis_max) queries

10.8.3 Tie breakers

10.8.4 Individual field boosting