Managing documents
The native APIs for managing documents (index, delete, and update) are the most important after the search APIs. In this recipe, we will see how to use them. In the next recipe, we will proceed to bulk actions to improve performances.
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 natively supports it for Java programming such as Eclipse or IntelliJ IDEA, must be installed.
The code for this recipe is in the chapter_14/nativeclient
 directory and the referred class is DocumentOperations
.
How to do it...
For managing documents, we will perform the following steps:
We'll need to import the required classes to execute all the document CRUD operations via the native client:
import org.elasticsearch.action.delete.DeleteResponse; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch...