Elasticsearch: CURD Operations and sorting documents by time stamp with scala using java api of elastic search


Knoldus

Elasticsearch is an open-source search engine built on top of Apache Lucene™, a full-text search-engine library. You can read it more on their website.

Elasticsearch is also written in Java and uses Lucene internally for all of its indexing and searching, but it aims to make full-text search easy by hiding the complexities of Lucene behind a simple, coherent, RESTful API.

In this post, we will learn to use elasticsearch java api in Scala. The scenario will be that we will perform CRUD operation on elasticsearch. Then searching and sorting on the basis of time stamp and retrieve specified size of document  from elasticsearch  index and validate it.

we will start with adding dependency of elasticsearch in the project. At the time 1.5.2 is the latest. Here is the snippet in build.sbt file.

name := “crudOnEs”

scalaVersion :=  “2.11.4”

libraryDependencies  ++= {
Seq(
“org.elasticsearch” % “elasticsearch” % “1.5.2”

View original post 742 more words

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s