- Spring Boot (Java)
- Redis
- Elastic Search
- RabbitMQ
- Authentication using Bearer Token generated by JWT
- Validate request JSON object with JSON Schema
- Cache Server Response and validate cache using ETag
- Support POST, PUT, PATCH, GET and DELETE Http Methods for the REST API
- Store JSON Objects in Redis key-value store for data persistence
- Index the JSON Objects in Elastic Server for Search capabilities
- Queueing indexing requests to Elastic Server using RabbitMQ
- Generate token using the
/token
endpoint - Validate further API requests using the Bearer Token
- Create JSON Object using the
POST
HTTP method - Validate incoming JSON Object using the respective JSON Schema
- De-Structure hierarchial JSON Object while storing in Redis key-value store
- Enqueue object in RabbitMQ queue to index the object
- Dequeue from RabbitMQ queue and index data in ElasticServer
- Implement Search queries using Kibana Console to retrieve indexed data
- Install the Prerequisites for the project:
- Redis Server (https://redis.io/download)
- ElasticSearch (https://www.elastic.co/downloads/elasticsearch)
- Kibana (https://www.elastic.co/downloads/kibana)
- RabbitMQ Server (https://www.rabbitmq.com/download.html)
- Start the Redis Server with the
redis-server
command - Start the ElasticSearch server with the
elasticsearch
command - Start Kibana with the
kibana
command - Start RabbitMQ server with the
rabbitmq-server
command - Clone the repository
git clone [email protected]:shah-tejas/BigDataIndexing.git
- Navigate to the project directory
cd BigDataIndexing/bdi-demo
- Start the Spring Boot application
mvn clean install spring-boot:run
This would start the server. Create the data using the REST API endpoints and query the indexed data on Kibana Console.
(A Sample JSON Object for the plan can be found here)
- GET
/token
- This generates a RSA-signed JWT token used to authenticate future requests. - POST
/plan
- Creates a new plan provided in the request body - PUT
/plan/{id}
- Updates an existing plan provided by the id- A valid Etag for the object should also be provided in the
If-Match
HTTP Request Header
- A valid Etag for the object should also be provided in the
- PATCH
/plan/{id}
- Patches an existing plan provided by the id- A valid Etag for the object should also be provided in the
If-Match
HTTP Request Header
- A valid Etag for the object should also be provided in the
- GET
/plan/{id}
- Fetches an existing plan provided by the id- An Etag for the object can be provided in the
If-None-Match
HTTP Request Header - If the request is successful, a valid Etag for the object is returned in the
ETag
HTTP Response Header
- An Etag for the object can be provided in the
- DELETE
/plan/{id}
- Deletes an existing plan provided by the id- A valid Etag for the object should also be provided in the
If-Match
HTTP Request Header
- A valid Etag for the object should also be provided in the
Sample queries can be fired on the Kibana Console to retrieve the indexed data
- Query all plans
GET planindex/_search { "query": { "match_all": {} } }
- Query based on a nested object's objectId, alongwith the nested object
GET planindex/_search { "query": { "nested": { "path": "linkedPlanServices.linkedService", "query": { "match": { "linkedPlanServices.linkedService.objectId": "1234520xvc30asdf-502" } }, "inner_hits": {} } } }
- Query wildcard text fields
GET planindex/_search { "query": { "wildcard": { "_org": { "value": "example*" } } } }
- Query nested object's wildcard text fields
GET planindex/_search { "query": { "nested": { "path": "linkedPlanServices.linkedService", "query": { "wildcard": { "linkedPlanServices.linkedService.name.keyword": { "value": "Year*" } } }, "inner_hits": {} } } }
- Range query on a numeric field
GET planindex/_search { "query": { "nested": { "path": "planCostShares", "query": { "range": { "planCostShares.copay": { "gte": 20, "lte": 35 } } }, "inner_hits": {} } } }