What’s Elasticsearch?
Elasticsearch is a search engine built on Apache Lucene and Solr. It is an open source and developed in Java. It is a real time distributed and analytic engine which helps in performing various kinds of search mechanism. It is able to achieve fast search responses because, instead of searching the text directly, it searches an index instead. Additionally, it supports full-text search which is completely based on documents instead of tables or schemas.
For more information :
Install Elasticsearch on Local
Download this link and extract anywhere on your machine:
Start leasticsearch on bin folder : elasticsearch.bat
Now, elasticsearch is working on your local maschine.
After that, we can start create java project..
Step by Step Elasticsearch Java Project
- Create a maven project and add this dependencies :
- Add item to product index : I created product index and you can change id and name,detail,price details for adding another item to this index.
- Delete item on index :
- Delete by query for multiple data : filter data and sent response for delete operation :
- Get Product with ID :
- Search on Products :
You can all operations on _search index link :
You can also use Postman for different operations.
Download project on Github and test all .. :
I hope it was useful, see you next story..