📅  最后修改于: 2023-12-03 15:31:23.634000             🧑  作者: Mango
The indices_primaries_active
metric is a metric that represents the number of active primary shards in your Elasticsearch cluster. This metric can help you understand the current workload of your cluster and provide insights into how your cluster is performing.
indices_primaries_active
metricTo retrieve the indices_primaries_active
metric, you can use the Elasticsearch APIs or the Kibana UI. Here are two examples:
You can use the following API to retrieve the indices_primaries_active
metric for each shard in your cluster:
GET /_cat/shards?h=index,shard,prirep,state,docs,store,ip,node&v
This API will return a table with information about the shards in your cluster, including the pri
column which represents the primary shard and the state
column which can be either RECOVERING
, STARTED
, INITIALIZING
or UNASSIGNED
. You can count the number of rows where pri
is equal to p
and state
is equal to STARTED
to get the indices_primaries_active
metric.
If you are using Kibana, you can retrieve the indices_primaries_active
metric by creating a Data Table
visualization. Follow these steps:
Go to the Kibana UI and click on Visualize
in the left-hand menu.
Click on Create a visualization
.
Select the Data Table
visualization type.
Select your Elasticsearch index pattern.
In the Metrics
section, click on the Add
button and select Metric
.
In the Aggregation
dropdown, select Count
.
In the Field
dropdown, type pri
and select Filter
.
In the Operation
dropdown, select Is equal to
.
In the Value
field, type p
.
In the Filters
section, click on the Add
button and select Add Filter
.
In the Field
dropdown, type state
and select Filter
.
In the Operation
dropdown, select Is equal to
.
In the Value
field, type STARTED
.
Click on the Save
button.
Click on the Visualize
button to view your Data Table
visualization.
The indices_primaries_active
metric will be displayed in the table.
The indices_primaries_active
metric is an important metric to monitor the workload and performance of your Elasticsearch cluster. By using Elasticsearch APIs or Kibana UI, you can easily retrieve this metric and take appropriate actions to optimize your cluster.