Skip to content

Latest commit

 

History

History
54 lines (36 loc) · 1.18 KB

README.md

File metadata and controls

54 lines (36 loc) · 1.18 KB

akka-http-elasticsearch

This is sbt project for showing case for querying and sending data to elasticsearch using Akka-http and how to write unit tests.

Getting Started:

Clone and run the unit test:

$ git clone [email protected]:techmonad/akka-http-elasticsearch.git
$ cd  akka-http-elasticsearch
$ sbt test

Elasticsearch Setup

i) Download the Elasticsearch 2.4.4 or latest version and unzip it.

ii) Run the following command.

    $ bin/elasticsearch

Run http server:

  $ sbt run

Test the http rest point using curl:

  1. Add the catalogue record

request:

  $  curl -XPOST 'localhost:9000/catalogue/add'  -d '{"id":1,"type":"book","author":"Martin Odersky","title":"Programming in Scala"}'

response:

 Record added to catalogue successfully
  1. Search by query

request:

$ curl -XPOST 'localhost:9000/catalogue/search' -d '{"author":"martin"}'

response:

 [{"id":2,"type":"book","author":"Martin Odersky","title":"Programming in Scala"}]