Welcome to this elasticsearch tutorial. Elastic search is a distributor, open search and analytics engine that can be used for various kinds of data. They can be structured, unstructured, textual and numerical data. Released in 2010, Elasticsearch is the main component of Elastic Stack.Â
In this article about Elasticsearch tutorial, let us look at:
To kick off this elasticsearch tutorial, let’s take a closer look at its API. The elasticsearch API’s are used by the UI components. They can also be used to configure and access Elasticsearch features.
1) Document API – These API’s are used in Elasticsearch for managing documents. They perform various functions such as creating documents in an index, moving and editing them and also removing them. They can be used for handling both single and multi-document API’s.
Query: PUT /<<indexname>>
cURL: curl -XPUT ‘localhost:9200/twitter/my_index/my_type/1?pretty’ -H ‘Content-Type: application/json’ -d'{ “field : “value”, …}’
Query: GET /<<indexname>>
cURL : curl -XGET’localhost:9200/my_index/my_type/0?pretty’
Query: DELETE /<<indexname>>
cURL : curl -XDELETE’localhost:9200/my_index/my_type/0?pretty’
Query : POST /_reindex
cURL : curl -XPOST’localhost:9200/_reindex?pretty’-H ‘Content-Type: application/json’ -d'{ “source”: { “index”: “some_old_index” }, “dest”: { “index”: “some_new_index” }}’
Query : GET /<<targetindex>>/_mget
cURL : curl -X GET “localhost:9200/_mget?pretty” -H ‘Content-Type: application/json’ -d'{ “docs”: [ { “_index”: “index1”, “_id”: “1” }, { “_index”: “index1”, “_id”: “2” } ]}
Query : POST /<<targetindex>>/_bulk
cURL : curl -X POST “localhost:9200/_bulk?pretty” -H ‘Content-Type: application/json’ -d'{ “index” : { “_index” : “test”, “_id” : “1” } }{ “delete” : { “_index” : “test”, “_id” : “2” } }{ “create” : { “_index” : “test”, “_id” : “3” } }{ “field1” : “value1” }}
Query : POST /<<targetindex>>/_delete_by_query
cURL : curl -X POST “localhost:9200/index1/_delete_by_query?pretty” -H ‘Content-Type: application/json’ -d'{ “query”: { “match”: { “user.id”: “gedalyahreback” } }}
Query : POST /<<targetindex>>/_update_by_query
cURL : curl -X POST “localhost:9200/myindex1/ _update_by_query?conflicts=proceed”
2) Search API – This API is used to query indexed data for specific information. They are responsible for managing individual indices. Mapping, index template and aliases. It depends on the usage of the Mustache language.
Query : GET /<<targetindex>>/_search
POST /<<targetindex>>/_search
cURL : curl -XGET’localhost:9200/my_index/my_type/_count?q=field:value&pretty’
Query : GET /<<targetindex>>/_validate/<<query>>
cURL : curl -XGET’localhost:9200/my_index/my_type/_validate?q=field:value’
Query : GET /<<targetindex>>/_explain/<<id>>
POST /<<targetindex>>/_explain/<<id>>
cURL : curl -XGET’localhost:9200/my_index/my_type/0/_explain?q=message:search’
Query : GET /_search/scroll
POST /_search/scroll
DELETE /_search/scroll
cURL : curl -X GET “localhost:9200/_search/scroll?pretty” -H ‘Content-Type: application/json’ -d'{}’
3) Indices API – This API allows the developer to manage the indices, templates and mappings.
4) Cluster API – These API helps in maintaining and managing the Elasticsearch cluster. They also identify which Elasticsearch node to call. It can be its internal node ID or the name or the address.
The next part of this elasticsearch tutorial is understanding queries. Elasticsearch renders a complete Query DSL that is based on JSON to represent queries. It has two types of clauses:
Mapping is the process of determining how the document, as well as the field it contains, is saved and filed. The two types of mapping namely, Dynamic mapping and Explicit mapping are used to represent the data. Each method has its own benefits.
The analysis process in Elasticsearch converts text into terms. These derived texts are included in the inverted index for searching. This process is undertaken by the Analyzer. The two types of the analyzer are,
Examples for analyzers include Standard, Simple, Whitespace, Stop, Keyword, Pattern, Language and Snowball.
The Elasticsearch module is used to control Elasticsearch across various versions. This is done through the use of certain metrics. They are equipped with the monitoring feature.
The module is tested with Elasticsearch 6.3 and works with versions6.x and higher.
The metric sets used are as follows:
This brings us to the end of this elasticsearch tutorial.Â
Want to know all relevant information about your future? Head to our website to check out the best and the latest information about various fields to build your knowledge and scope.
Fill in the details to know more
Hadoop YARN Architecture: A Tutorial In 5 Simple Points
May 10, 2021
SAS Tutorial: An Interesting Overview In 2021
PyCharm Tutorial: A Detailed Guide In 7 Points
Cassandra Tutorial: An Ultimate Guide In 6 Points
Amazon’s DynamoDB Tutorial – A Simplified Guide For 2021
Puppet Tutorial For Beginners In 7 Easy Points
Add your details:
By proceeding, you agree to our privacy policy and also agree to receive information from UNext through WhatsApp & other means of communication.
Upgrade your inbox with our curated newletters once every month. We appreciate your support and will make sure to keep your subscription worthwhile