Chapter 5. Search

In this chapter, we will cover the following recipes:

  • Executing a search
  • Sorting results
  • Highlighting results
  • Executing a scrolling query
  • Using the search_after functionality
  • Returning inner hits in results
  • Suggesting a correct query
  • Counting matched results
  • Explaining a query
  • Query profiling
  • Deleting by query
  • Updating by query
  • Matching all the documents
  • Using a Boolean query

Introduction

Now we have set the mappings and put the data in the indices, we can search.

In this chapter, we will cover the search using different factors: sorting, highlighting, scrolling, suggesting, counting, and deleting. These actions are the core part of Elasticsearch: ultimately, everything in Elasticsearch is about serving the query and returning good-quality results.

This chapter is divided in two parts: the first part shows how to perform an API call-related search, the last part will look at two special query operators that are the basis for building complex queries in the next chapters.

All the recipes in this chapter require us to prepare and populate the required indices: the online code is available on the PacktPub website (https://www.packtpub.com/big-data-and-business-intelligence/elasticsearch-cookbook) or via GitHub (https://github.com/aparo/elasticsearch-cookbook-third-edition). There are scripts to initialize all the required data.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.146.107.89