In the last two chapters, we looked at term-level and full-text queries. We discussed searching structured and unstructured data using queries, some producing relevance scores and others working in a filter context where scores are irrelevant. Most queries allow setting simple search criteria and working on a limited set of fields, such as finding books written by an author or searching for best-selling books.
In addition to providing queries for complex criteria, we sometimes need to boost scores based on certain criteria while at the same time negating scores for negative matches (for example, all books launched during a training program may get a positive boost while simultaneously, expensive books are suppressed [negated]). Or maybe we want to set scores based on custom requirements rather than using Elasticsearch’s built-in relevance algorithms.