esclient


License

License

Categories

Categories

Scala Languages CLI User Interface
GroupId

GroupId

org.scalastuff
ArtifactId

ArtifactId

esclient_2.11
Last Version

Last Version

1.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

esclient
esclient
Project URL

Project URL

https://github.com/scalastuff/esclient
Project Organization

Project Organization

org.scalastuff
Source Code Management

Source Code Management

https://github.com/scalastuff/esclient

Download esclient_2.11

How to add to project

<!-- https://jarcasting.com/artifacts/org.scalastuff/esclient_2.11/ -->
<dependency>
    <groupId>org.scalastuff</groupId>
    <artifactId>esclient_2.11</artifactId>
    <version>1.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.scalastuff/esclient_2.11/
implementation 'org.scalastuff:esclient_2.11:1.3.0'
// https://jarcasting.com/artifacts/org.scalastuff/esclient_2.11/
implementation ("org.scalastuff:esclient_2.11:1.3.0")
'org.scalastuff:esclient_2.11:jar:1.3.0'
<dependency org="org.scalastuff" name="esclient_2.11" rev="1.3.0">
  <artifact name="esclient_2.11" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.scalastuff', module='esclient_2.11', version='1.3.0')
)
libraryDependencies += "org.scalastuff" % "esclient_2.11" % "1.3.0"
[org.scalastuff/esclient_2.11 "1.3.0"]

Dependencies

compile (2)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.1
org.elasticsearch : elasticsearch jar 1.3.0

Project Modules

There are no modules declared in this project.

ESClient

Minimalistic Elastic Search client for scala. It's a thin wrapper around the java client, adding the following features:

  • Asynchronous interface
  • Based on Scala 2.10 Futures
  • Single dispatch method (execute)
  • Type-safe Request / Response pairs using 'magnet' pattern

The signature of the execute method (slightly simplified):

package  org.scalastuff.esclient
import org.elasticsearch.client.Client

implicit class ESClient(client : Client) extends AnyVal {
  def execute[Request, Response](request: Request): Future[Response]
}

Getting started

ESClient is available on maven central.

 libraryDependencies += "org.scalastuff" %% "esclient" % "1.0.0"

ESClient has been compiled for scala 2.10 and 2.11.

Sample

import scala.concurrent.Await
import scala.concurrent.Future
import scala.concurrent.duration.DurationInt

import org.elasticsearch.action.index.IndexRequest
import org.elasticsearch.action.index.IndexResponse
import org.elasticsearch.client.Client
import org.elasticsearch.node.NodeBuilder.nodeBuilder
import org.scalastuff.esclient.ESClient

object TestES extends App {

  val client : Client = 
    nodeBuilder.node.client
  
  val response : Future[IndexResponse] = 
    client.execute(new IndexRequest) 
      
  println("Document id: " + Await.result(response, 5 seconds).id)
}

License

This software is released under the Apache License, Version 2.0

http://www.apache.org/licenses/LICENSE-2.0.html

Versions

Version
1.3.0
1.2.1
1.0.0