ElasticSearch is an open source, scalable full-text search engine from the Apache Lucene infrastructure. ElasticSearch is one of the tools developed to deal with the problems of the big data world.
As the databases grow, there are speed / performance problems in the query process. It will take a long time to find the searched data. The solution is to categorize the words in the text fields by indexing them sequentially. In this way, even when working with large data, we increase the performance of the database.
ElasticSearch provides full-text search capabilities such as multi-language support, powerful query language and autocomplete.
How does Elasticsearch search?
Elasticsearch; Instead of searching directly via text, it generates results very quickly by searching through indexes. Indexes which data in a document is stored when saving data. Then, when we want to search for a word, instead of searching on all the data, the results are quickly found on the index list.
For example, when 6 records are added to the top image, elasticsearch categorizes the words in this record and lists in which list the word is on a new list. When we search, it returns results from the new list that is indexed, not from records anymore.
Elasticsearch has developed a number of terms to keep them organized while saving data. This is like a normal database.
- Index: Each database is specified as index.
- Type: Tables in the database.
Example: products, categories, orders, price
- Field: Columns in tables.
Example: products=> id
- Documents: Our records in the table.
- Mapping: Schemas in our database.
Example: string, integer, double, boolean
- Shard: When an index contains too many data, it can be able to force the hardware storage limits of the node. To solve this problem, elasticsearch uses the “shards” structure, which allows us to split an index into multiple parts. When you create an index, you can easily define how many shard you want to use. Each shard has a fully independent index that has all the features of an index and can be hosted on any node in the cluster.
The default url: http: // localhost: 9200 comes when you install Elasticsearch.
ElasticSearch provides services through RestfulAPI. It can work easily on both Windows and Linux.
Client support is available for many platforms such as Java, Php, Python, Perl, Ruby, .NET.
I tried to briefly explain Elasticsearch.
We mentioned about indexing continuous records throughout the article. Let me briefly explain the indexing feature in mysql.
There are 2 types of indexes;
1- Clustered Index (Primary Index): Ensures that data is sorted continuously. Only one column can be given in each table. All added records are sorted by Clustered Index. So this shows that it is always a regular structure. If there is a column with a Primary Key constraint, this column has the Clustered Index property.
2- Non-Clustered (Secondary Index): Clustered Index is given to only one column. Well, when we wanted to search in another column, they improved it to prevent the performance from falling. Working logic background creates its own table. Sorts that table regularly according to the column to search. We can mark all columns as Non-Clustered.