Managing documents

The APIs for managing documents (index, delete, and update) are the most important after the search ones. In this recipe, we will see how to use them.

Getting ready

You need an up-and-running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe in Chapter 2, Downloading and Setup.

A Maven tool, or an IDE that supports Scala programming, such as Eclipse (ScalaIDE) or IntelliJ IDEA, with the Scala plugin should be installed.

The code of this recipe can be found in the chapter_15/elastic4s_sample file and the referred class is DocumentExample.

How to do it...

For managing documents, we will perform the following steps:

  1. We'll need to import the required classes to execute all the document CRUD ...

Get Elasticsearch 5.x Cookbook - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.