Using Elasticsearch with Alpakka
The Alpakka project (https://doc.akka.io/docs/alpakka/current/index.html) is a reactive enterprise integration library for Java and Scala, based on Reactive Streams and Akka (https://akka.io/).
Reactive Streams is based on components – the most important ones are Source (which is used to read data from different sources) and Sink (which is used to write data in storage).
Alpakka supports Source and Sink for many data stores, Elasticsearch being one of them.
In this recipe, we will go through a common scenario – reading a CSV file and ingesting it in Elasticsearch.
Getting ready
You need an up-and-running Elasticsearch installation, as we described in the Downloading and installing Elasticsearch recipe in Chapter 1, Getting Started.
An IDE that supports Scala programming, such as IntelliJ IDEA with the Scala plugin, should be installed globally.
The code for this recipe can be found in the ch17/alpakka
directory, and...