Chapter 14: Scala Integration

Scala is becoming one of the most widely used languages in big data scenarios. This language provides a lot of facilities for managing data, such as immutability and functional programming.

In Scala, you can simply use the libraries that we saw in the previous chapter for Java. However, they are not scalastic, as they don't provide type safety (because many of these libraries take JSON as a string), and it is easy to use asynchronous programming.

In this chapter, we will look at how we can use elastic4s, a mature library, to use Elasticsearch in Scala. Its main features are as follows:

  • It has type-safe, concise DSL.
  • It integrates with standard Scala futures.
  • It uses the Scala collections library over the Java collections. ...

Get Elasticsearch 8.x Cookbook - Fifth 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.