Skip to content

An REST Client Application that searches contents and viewing activity of user using ElasticSearch.

Notifications You must be signed in to change notification settings

kushalsethi/contentsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

contentsearch

A REST API that helps you storing the contents and viewing activity of Users and getting contents based on tags provided in request. Elasticsearch is used to search through records.

Prerequisite
You need to have Elasticsearch-6.2.1 (https://www.elastic.co/downloads/past-releases) installed/extracted on your machine.

Steps to start application:

Run below command in root directory,
mvn clean install

Start elasticsearch local server. (\elasticsearch-6.x.x\bin\elasticsearch.bat)

Hit http://localhost:9200 to test elasticsearch server is up!

Configure this application if elasticsearch is running on different server or port.

Start AppLauncher from contentsearch/src/main/java/com/kushals/application/AppLauncher.java

 `java AppLauncher`

This will start spring boot application listening to localhost 8080 port.

Mappings for the documents
Default mapping can be found at src/main/resources/template directory.
There are two mappings for ContentLibrary and ViewingActivity

REST APIs:

-To add Content to library use below REST end point,
PUT http://localhost:8080/contentsearch/contents/add
Provide your content information in request body.

-To search contents by tag use below REST end point,
GET http://localhost:8080/contentsearch/contents/get?tag=Romance
This will return all the contents tagged as Romance category.

-To add viewing activity of a user use below REST end point,
PUT http://localhost:8080/contentsearch/activity/add
Provide your viewing activity information in request body.
Ex:
{ "id": "1111", "user" : "ABC XYZ", "location" : "Mumbai", "contents_viewed" : [{ "title" : "Some video content name", "metadata" : { "region" : "IN", "long_synopsis" : "long synopsis details", "meta_desc" : "meta description details", "tags": [ "Asemic writing", "Comedy" ] }, "status" : "published", "id" : "960b7d96-9106-49a4-9106-8b1b60760b7d", "date" : 1519821669966 }] }

To get content based on location and tag use below REST end point,
GET http://localhost:8080/contentsearch/activity/get?tag=Romance&location=Mumbai
This should give you the contents tagged with given tag from given location.

Thanks!

About

An REST Client Application that searches contents and viewing activity of user using ElasticSearch.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages