Posts

Showing posts from October, 2016

Elastic Search with Spring PART II

1) Index creation or deletion: For Nested Type (Index name is Book) and Parent - Child Relationship (Index name is ParChild) @RequestMapping(value="/addIndex",method = RequestMethod.POST) def addBookIndex(@RequestParam(name = "indexName")String indexName){ logger.info "****** Adding Book Index: $indexName in ELASTIC DB......" def result = elasticsearchTemplate.createIndex(indexName) logger.info "****** Result is: $result " result } @RequestMapping(value="/deleteIndex",method = RequestMethod.POST) def deleteBookIndex(@RequestParam(name = "indexName")String indexName){ logger.info "****** Deleting Book Index: $indexName in ELASTIC DB......" def result = elasticsearchTemplate.deleteIndex(indexName) logger.info "****** Result is: $result " result } 2) Creating Mapping Type Whenever we save a doc

Elastic Search with Spring

Image
ElasticSearch quite a familiar term. The first question that comes in our mind is: 1) What ElasticSearch is? & 2) Why should we use it? So to answer the first question, I would like to describe ElasticSearch as a wrapper over Apache Lucene (Apache Lucene is a high performance, text search engine library written in Java). So, ElasticSearch in its core is a distributed full-text search engine which is incredibly easy to scale (because of its well designed anatomy), returns results at a lightning speed (because of its analyzers which tokenize the texts and creates a reverse indexing just like the indexing of a book, a variety of analyzers are available), schema free in nature and supports JSON. The best part about elastic search which I experienced is all its functionalities are being exposed as REST services. ElasticSearch is a distributed NO SQL database where every input to it goes in JSON format and it has its very own way of storing data in data file