es-client


License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.github.piotr-kalanski
ArtifactId

ArtifactId

es-client_2.11
Last Version

Last Version

0.3.0
Release Date

Release Date

Type

Type

jar
Description

Description

es-client
es-client
Project URL

Project URL

https://github.com/piotr-kalanski/es-client
Project Organization

Project Organization

com.github.piotr-kalanski
Source Code Management

Source Code Management

https://github.com/piotr-kalanski/es-client

Download es-client_2.11

How to add to project

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

Dependencies

compile (5)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.11.8
org.scala-lang : scala-reflect jar 2.11.8
org.scalaj : scalaj-http_2.11 jar 2.3.0
org.json4s : json4s-native_2.11 jar 3.2.11
org.json4s : json4s-jackson_2.11 jar 3.2.11

test (2)

Group / Artifact Type Version
junit : junit jar 4.10
org.scalatest : scalatest_2.11 jar 2.2.6

Project Modules

There are no modules declared in this project.

es-client

Lightweight Scala Elasticsearch client implemented using Elasticsearch REST API.

Build Status codecov.io Stories in Ready License

Table of contents

Goals

  • Speed up unit testing when using Spark
  • Enable switching between Spark execution engine and Scala collections depending on use case, especially size of data without changing implementation

Getting started

Include dependencies

"com.github.piotr-kalanski" % "es-client_2.11" % "0.2.0"

or

<dependency>
    <groupId>com.github.piotr-kalanski</groupId>
    <artifactId>es-client_2.11</artifactId>
    <version>0.2.0</version>
</dependency>

Create Elasticsearch repository

import com.datawizards.esclient.repository.ElasticsearchRepositoryImpl

val repository = new ElasticsearchRepositoryImpl("http://localhost:9200")

Examples

Create index

val mapping =
    """{
      |   "mappings" : {
      |      "Person" : {
      |         "properties" : {
      |            "name" : {"type" : "string"},
      |            "age" : {"type" : "integer"}
      |         }
      |      }
      |   }
      |}""".stripMargin

val indexName = "persontest"
repository.createIndex(indexName, mapping)

Check if index exists

repository.indexExists(indexName)

Delete index

repository.deleteIndex(indexName)

Writing and reading documents

case class Person(name: String, age: Int)

repository.write("people", "person", "1", Person("p1", 20))
repository.read[Person]("people", "person", "1")

Versions

Version
0.3.0
0.2.1
0.2.0
0.1.0