chapter five
5 Working with documents
This chapter covers
- Indexing, retrieving, and reindexing documents
- Manipulating and tweaking responses
- Updating and deleting documents with APIs and query methods
- Working with scripted updates
- Indexing documents in bulk
It is time to work with and understand operations on documents in Elasticsearch. Documents are indexed, fetched, updated, or deleted as per the requirement. We can load the data into Elasticsearch either from various stores such as databases and files or from real time streams. Similarly, we can update or modify the data that exists in Elasticsearch. If needed, we can even delete and purge the documents. For example, we may have a product catalog database that needs to be imported into Elasticsearch to enable search capabilities on the products.
Elasticsearch exposes a set of APIs for working with our documents:
- The document indexing APIs—Indexes documents into Elasticsearch
- The read and search APIs—Allows clients to fetch documents from Elasticsearch
- The update APIs—Allows us to modify the fields of a document
- The delete APIs—Removes documents from the store