Javatpoint Logo
Javatpoint Logo

Elasticsearch APIs

In this section of Elasticsearch tutorial, we will discuss various types of APIs present in Elasticsearch. In order to interact with database, we use these APIs along with HTTP methods like GET, PUT, POST, and DELETE. Elasticsearch offers extensive REST APIs that allow us to manage, integrate, and query the indexed data in various ways. Elasticsearch has five types of APIs.

  1. Document APIs
  2. Search APIs
  3. Aggregation
  4. Index APIs
  5. Cluster APIs
Elasticsearch APIs

Let's understand them in detail -

Document APIs

Document APIs are those APIs that operate on the document level. So, if in case you want to perform some operation at the document level, you have to make use of the document appear. You can very well do that with the help of document APIs.

Document APIs is divided into two types of APIs that are single document API and multi-document API -

1. Single Document API

These APIs are useful if you want to perform operations on a single document rather than in bulk. So, you can use these APIs to execute queries on data. Single Document APIs is further classified into four APIs, which are listed below:

  • Index API
  • Get API
  • Update API
  • Delete API

2. Multi-Document API

Unlike a single document API, you can use the multi-document APIs for querying across multiple documents. For example - delete or update data in bulk, and reindex, etc. Multi-document APIs is further classified into five APIs, which are listed below:

  1. Multi Get API
  2. Bulk API
  3. Delete By Query API
  4. Update By Query API
  5. Reindex API

We will discuss Document API and their sub-division in further tutorials. For more detail, Click Here.

Search APIs

Search APIs are used for search across indexes and all types. It helps to search the data in Elasticsearch by executing the search query and get back the search result matched with the query. This API enables you to search the data within Elasticsearch. You can search the data in two ways -

  • Either by sending a get request with a query that has a string parameter or
  • Using post request that consists query in the message body.

Search API is further classified into three types:

  1. Multi-Index
  2. Multi-Type
  3. URI Search

We will discuss Search API and their types in further tutorials. For more detail, Click Here.


In Elasticsearch, the Aggregation framework is used for aggregation. It is responsible for providing aggregated data. So, it collects all the data, which is selected by search query. In Elasticsearch, several types of aggregations are available, which are generalized in 4 major families for simplification. These are -

  1. Bucketing
  2. Metric
  3. Matrix
  4. Pipeline

We will discuss aggregation and their types in further tutorials. For more detail, Click Here.

Index APIs

Index API or Indices API performs the operation at the index level. It is responsible for managing different indices, index settings, index templates, mapping, and aliases. It provides access to indices, mapping, and aliases, etc.

When a request is made for an index with specific mapping, this API helps to add or update the JSON document in that respective index.

There is a list of operations given below that we can perform on Index APIs:

  1. Create Index
  2. Get Index
  3. Delete Index
  4. Open/Close Index
  5. Index Aliases
  6. Index Exits
  7. Analyze
  8. Index Template
  9. Index Settings
  10. Index Stats
  11. Flush
  12. Refresh

We will discuss the Index APIs and these operations in further tutorials. For more detail, Click Here.

Cluster APIs

With the help of Cluster API, you can perform the operation at the cluster level. We can use this API to manage our clusters. In Elasticsearch, this API helps to fetch the information about a cluster and its node. It also makes further changes in them.

As we said, this is a distributed environment where we have a lot of nodes and this elasticsearch environment can be multi-node deployment as well. So, in this case, cluster API gives us information with respect to the cluster. Following are some of the commands, which can execute to get more information about a cluster:

  1. Cluster Health
  2. Cluster State
  3. Cluster Stats
  4. Pending Cluster Tasks
  5. Node Stats
  6. Node hot_thread

We will discuss the Cluster APIs and commands further in detail. For more detail, Click Here.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA