📜  indices_primaries_active (1)

📅  最后修改于: 2023-12-03 15:31:23.634000             🧑  作者: Mango

Indices Primaries Active

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.

Retrieving the indices_primaries_active metric

To retrieve the indices_primaries_active metric, you can use the Elasticsearch APIs or the Kibana UI. Here are two examples:

Elasticsearch APIs

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.

Kibana UI

If you are using Kibana, you can retrieve the indices_primaries_active metric by creating a Data Table visualization. Follow these steps:

  1. Go to the Kibana UI and click on Visualize in the left-hand menu.

  2. Click on Create a visualization.

  3. Select the Data Table visualization type.

  4. Select your Elasticsearch index pattern.

  5. In the Metrics section, click on the Add button and select Metric.

  6. In the Aggregation dropdown, select Count.

  7. In the Field dropdown, type pri and select Filter.

  8. In the Operation dropdown, select Is equal to.

  9. In the Value field, type p.

  10. In the Filters section, click on the Add button and select Add Filter.

  11. In the Field dropdown, type state and select Filter.

  12. In the Operation dropdown, select Is equal to.

  13. In the Value field, type STARTED.

  14. Click on the Save button.

  15. Click on the Visualize button to view your Data Table visualization.

  16. The indices_primaries_active metric will be displayed in the table.

Conclusion

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.