Tip:
Highlight text to annotate it
X
Hello friends. I'm Hüseyin Akdoğan from kodcu.com
After writing a series of posts about ElasticSearch in kodcu.com,
I am making this video recording in order to intensify the issues visually
I dealt with and introduce you with the web application that you can see it now on the screen which exemplifies the usage of ElasticSearch in a web application.
I will try to answer some questions shortly such as what is ElasticSearch,
what does it do for those who watched the video and don't read my posts or who don't know anything about ElasticSearch.
ElasticSearch is one of the tools that was developed for dealing with the problems pertain to world of big data.
Elasticsearch is an open source,
distributed and scalable full text search engine and also a data analysis tool.
Elasticsearch is document-oriented.
It means that each record is a structured JSON document in ElasticSearch.
Another important information; ElasticSearch is RESTfull Api driven.
It is possible to do almost every action with RESTfull API by using JSON through HTTP.
We have already tried to exemplify the basic operations with curl in the articles in kodcu.com
Details are available in kodcu.com. If you want, take a look at those articles.
As we mentioned HTTP in here,
we must address that the web application is currently running now and this is an instance of ElasticSearch.
The http port of the instance that can be seen here is: 9200
I want to show you the application directory.
For a better understanding of the cluster and node issues that we have discussed in the articles.
Because the application is run before and it is running now,
you can see here a data folder.
This is the main directory where the documents that are stored by ElasticSearch took place in.
Clusters are located under the data folder.
Unless otherwise specified, the default cluster name in ElasticSearch is ElasticSearch.
We have a cluster by the name of ElasticSearch in here and under this, node folders are located.
As you can see, there is a single node at the moment.
Our indices are located in the node. We only have a single index; kodcucom index.
Now I want to show you what will happen when I start a new instance from the terminal.
A new instance is started and a second node is created immediately.
As you can see when you look into,
the indices in the other node (we have only a single node, kodcucom) is replicated here.
When the number of nodes is increased in this way,
the data is replicated by ElasticSearch unless otherwise specified.
I will make a GET request through the terminal.
Let's look at this one first.
The http port of this instance is 9201.
Now, I will make a get request through the 9201 port.
I will reach the record which has a id value 1 because the data was replicated.
As you see, we are able to reach this data in this way.
When I make any changes in this document through this port
or add a new document, this will be reflected to other node (i.e. the number zero node).
I put much emphasize on this issue because it is important for you to understand it.
I am not giving the details of operations that can be done through the terminal
because I dealt with them much in my articles.
I want to return to web application again.
This web application is using Java API in the background which I tried to introduce you with in my articles in kodcu.com.
It carries out all operations through Java API.
This application was built with JavaServer Faces but different java web framework can also be used.
Any necessity relationship is not in question in terms of ElasticSearch.
This application fulfills the basic operations such as creating document, updating and deleting.
As an extra, there is a query input box in order to see full text search.
As you can see, query is executed in all fields.
QueryString was used.
QueryString provides us to run query operations on the specified fields.
It allows you to run query on all fields by default.
It also allows an opportunity to use wildcard.
As you can see here, * wildcard was used. It means any character, including empty.
This means you should return the records which match
with the text no matter which character items take place before and after the text.
Full text search is being experienced here in this way.
I used PrimaFaces component library.
JSON documents are converted to POJO in order to take full advantage of functionality
that is provided by primefaces datatable, not for listing the documents to datatable.
You can see details when you examine the code.
Selections made in datatable are reflected to form area
and operations such as updating and deleting are carried out.
I will end the video recording after entering a simple registration,
then making an update on it and deleting this registration.
As I stated in my last published article, my main objective here is to give
you an idea about the advantages provided by a web application of ElasticSearch for the database I/O opearions
where bottleneck risk is a big matter.
In high-trafficked enterprise applications where hundreds or thousands requests are being made in one minute,
it is possible to face bottleneck risk of database operations.
ElasticSearch is a very useful tool for these situations.
I developed this application with the purpose of helping you to have an opinion in this sense.
As you see, we entered the registration and it is reflected to datatable immediately.
Let's do an update on this record and change as a new content.
It was updated.
And finally, let's see the remove operation.
We can do all these operations.
And also here is a button which brings all the documents.
This is a simple application but I hope it will help you to gain an insight.
You can reach this application through my github account.
It is a repository named ElasticSearch.
That's all about what I want to express for ElasticSearch.
Good bye until we will meet for another occasion.