Elasticsearch:Usage API
2022年11月10日 | by mebius
我们可以通过这个 API提供有关已安装 X-Pack 功能的使用信息。它的请求形式为:
GET /_xpack/usage
前提条件
如果启用了 Elasticsearch 安全功能,你必须具有 monitor 或 manage cluster 权限才能使用此 API。
描述
此 API 提供有关当前许可证下当前启用和可用的功能以及一些使用统计信息的信息。
请求参数
master_timeout:这是个可选参数,它表示 time units。等待连接到主节点的时间。 如果在超时到期之前没有收到响应,则请求失败并返回错误。 默认为 30 秒。
例子
GET /_xpack/usage
上面的命令在我的电脑上返回的结果如下:
{
"aggregate_metric": {
"available": true,
"enabled": true
},
"analytics": {
"available": true,
"enabled": true,
"stats": {
"boxplot_usage": 0,
"cumulative_cardinality_usage": 0,
"string_stats_usage": 12,
"top_metrics_usage": 7,
"t_test_usage": 0,
"moving_percentiles_usage": 0,
"normalize_usage": 0,
"rate_usage": 0,
"multi_terms_usage": 0
}
},
"ccr": {
"available": false,
"enabled": true,
"follower_indices_count": 0,
"auto_follow_patterns_count": 0
},
"data_streams": {
"available": true,
"enabled": true,
"data_streams": 4,
"indices_count": 5
},
"data_tiers": {
"available": true,
"enabled": true,
"data_warm": {
"node_count": 1,
"index_count": 1,
"total_shard_count": 1,
"primary_shard_count": 1,
"doc_count": 85446,
"total_size_bytes": 53885756,
"primary_size_bytes": 53885756,
"primary_shard_size_avg_bytes": 53885756,
"primary_shard_size_median_bytes": 53885756,
"primary_shard_size_mad_bytes": 0
},
"data_frozen": {
"node_count": 1,
"index_count": 0,
"total_shard_count": 0,
"primary_shard_count": 0,
"doc_count": 0,
"total_size_bytes": 0,
"primary_size_bytes": 0,
"primary_shard_size_avg_bytes": 0,
"primary_shard_size_median_bytes": 0,
"primary_shard_size_mad_bytes": 0
},
"data_cold": {
"node_count": 1,
"index_count": 0,
"total_shard_count": 0,
"primary_shard_count": 0,
"doc_count": 0,
"total_size_bytes": 0,
"primary_size_bytes": 0,
"primary_shard_size_avg_bytes": 0,
"primary_shard_size_median_bytes": 0,
"primary_shard_size_mad_bytes": 0
},
"data_content": {
"node_count": 1,
"index_count": 13,
"total_shard_count": 16,
"primary_shard_count": 16,
"doc_count": 3104,
"total_size_bytes": 57271904,
"primary_size_bytes": 57271904,
"primary_shard_size_avg_bytes": 3579494,
"primary_shard_size_median_bytes": 10238,
"primary_shard_size_mad_bytes": 10013
},
"data_hot": {
"node_count": 1,
"index_count": 4,
"total_shard_count": 4,
"primary_shard_count": 4,
"doc_count": 64515,
"total_size_bytes": 49585439,
"primary_size_bytes": 49585439,
"prtgcodeimary_shard_size_avg_bytes": 12396359,
"primary_shard_size_median_bytes": 45137,
"primary_shard_size_mad_bytes": 26232
}
},
"eql": {
"available": true,
"enabled": true,
"features": {
"joins": {
"join_queries_three": 0,
"join_queries_two": 0,
"join_until": 0,
"join_queries_five_or_more": 0,
"join_queries_four": 0
},
"sequence": 0,
"keys": {
"join_keys_two": 0,
"join_keys_one": 0,
"join_keys_three": 0,
"join_keys_five_or_more": 0,
"join_keys_four": 0
},
"join": 0,
"sequences": {
"sequence_queries_three": 0,
"sequence_queries_four": 0,
"sequence_queries_two": 0,
"sequence_until": 0,
"sequence_maxspan": 0,
"sequence_queries_five_or_more": 0
},
"event": 0,
"pipes": {
"pipe_tail": 0,
"pipe_head": 0
}
},
"queries": {
"all": {
"total": 0,
"failed": 0
},
"_all": {
"total": 0,
"failed": 0
}
}
},
"frozen_indices": {
"available": true,
"enabled": true,
"indices_count": 0
},
"graph": {
"available": false,
"enabled": true
},
"ilm": {
"policy_count": 26,
"policy_stats": [
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
},
"delete": {
"min_age": 7776000000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 1
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"set_priority",
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_size": "50gb",
"max_size_bytes": 53687091200
},
"set_priority": {
"priority": 100
}
}
},
"delete": {
"min_age": 31536000000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"set_priority",
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_size": "50gb",
"max_size_bytes": 53687091200
},
"set_priority": {
"priority": 100
}
}
},
"delete": {
"min_age": 31536000000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"warm": {
"min_age": 172800000,
"actions": [
"shrink",
"forcemerge",
"migrate"
],
"configurations": {
"forcemerge": {
"max_num_segments": 1
},
"shrink": {
"number_of_shards": 1
}
}
},
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
},
"delete": {
"min_age": 2592000000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "1d",
"max_age_millis": 86400000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
},
"delete": {
"min_age": 86400000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
}
},
"indices_managed": 1
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
},
"delete": {
"min_age": 7776000000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"set_priority",
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_size": "50gb",
"max_size_bytes": 53687091200
},
"set_priority": {
"priority": 100
}
}
},
"delete": {
"min_age": 31536000000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_primary_shard_size": "10gb",
"max_primary_shard_size_bytes": 10737418240
}
}
},
"delete": {
"min_age": 2592000000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 1
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"set_priority",
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "1d",
"max_age_millis": 86400000
},
"set_priority": {
"priority": 100
}
}
},
"delete": {
"min_age": 1209600000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_tgcodemanaged": 0
},
{
"phases": {
"warm": {
"min_age": 172800000,
"actions": [
"shrink",
"forcemerge",
"migrate"
],
"configurations": {
"forcemerge": {
"max_num_segments": 1
},
"shrink": {
"number_of_shards": 1
}
}
},
"cold": {
"min_age": 2592000000,
"actions": [
"migrate"
],
"configurations": {}
},
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
},
"delete": {
"min_age": 15552000000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
}
},
"indices_managed": 0
},
{
"phases": {
"warm": {
"min_age": 172800000,
"actions": [
"shrink",
"forcemerge",
"migrate"
],
"configurations": {
"forcemerge": {
"max_num_segments": 1
},
"shrink": {
"number_of_shards": 1
}
}
},
"cold": {
"min_age": 2592000000,
"actions": [
"migrate"
],
"configurations": {}
},
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
},
"delete": {
"min_age": 7776000000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "3d",
"max_age_millis": 259200000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
},
"delete": {
"min_age": 345600000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_size": "50gb",
"max_size_bytes": 53687091200
}
}
},
"delete": {
"min_age": 7776000000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 1
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"set_priority",
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "1d",
"max_age_millis": 86400000
},
"set_priority": {
"priority": 100
tgcode }
}
},
"delete": {
"min_age": 1209600000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
}
},
"indices_managed": 0
},
{
"phases": {
"warm": {
"min_age": 0,
"actions": [
"forcemerge",
"migrate"
],
"configurations": {
"forcemerge": {
"max_num_segments": 1
}
}
},
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "3d",
"max_age_millis": 259200000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
},
"delete": {
"min_age": 259200000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 2
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"set_priority",
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_size": "50gb",
"max_size_bytes": 53687091200
},
"set_priority": {
"priority": 100
}
}
},
"delete": {
"min_age": 31536000000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_size": "300gb",
"max_size_bytes": 322122547200
}
}
},
"delete": {
"min_age": 7776000000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"warm": {
"min_age": 172800000,
"actions": [
"shrink",
"forcemerge",
"migrate"
],
"configurations": {
"forcemerge": {
"max_num_segments": 1
},
"shrink": {
"number_of_shards": 1
}
}
},
"cold": {
"min_age": 2592000000,
"actions": [
"migrate"
],
"configurations": {}
},
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
},
"delete": {
"min_age": 31536000000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"warm": {
"min_age": 172800000,
"actions": [
"shrink",
"forcemerge",
"migrate"
],
"configurations": {
"forcemerge": {
"max_num_segments": 1
},
"shrink": {
"number_of_shards": 1
}
}
},
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "7d",
"max_age_millis": 604800000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
},
"delete": {
"min_age": 604800000,
"actions": [
"delete",
"migrate"
],
"configurations": {}
}
},
"indices_managed": 0
},
{
"phases": {
"hot": {
"min_age": 0,
"actions": [
"rollover",
"migrate"
],
"configurations": {
"rollover": {
"max_age": "30d",
"max_age_millis": 2592000000,
"max_primary_shard_size": "50gb",
"max_primary_shard_size_bytes": 53687091200
}
}
}
},
"indices_managed": 0
}
]
},
"logstash": {
"available": false,
"enabled": true
},
"ml": {
"available": false,
"enabled": true,
"jobs": {
"_all": {
"count": 0,
"detectors": {
"total": 0,
"min": 0,
"avg": 0,
"max": 0
},
"created_by": {},
"model_size": {
"total": 0,
"min": 0,
"avg": 0,
"max": 0
},
"forecasts": {
"total": 0,
"forecasted_jobs": 0
}
}
},
"datafeeds": {
"_all": {
"count": 0
}
},
"data_frame_analytics_jobs": {
"memory_usage": {
"peak_usage_bytes": {
"total": 0,
"min": 0,
"avg": 0,
"max": 0
}
},
"_all": {
"count": 0
},
"analysis_counts": {}
},
"inference": {
"ingest_processors": {
"_all": {
"pipelines": {
"count": 0
},
"time_ms": {
"sum": 0,
"min": 0,
"max": 0
},
"num_docs_processed": {
"sum": 0,
"min": 0,
"max": 0
},
"num_failures": {
"sum": 0,
"min": 0,
"max": 0
}
}
},
"trained_models": {
"model_size_bytes": {
"total": 0,
"min": 0,
"avg": 0,
"max": 0
},
"estimated_operations": {
"total": 0,
"min": 0,
"avg": 0,
"max": 0
},
"count": {
"total": 1,
"prepackaged": 1,
"other": 0
},
"_all": {
"count": 1
}
},
"deployments": {
"inference_counts": {
"total": 0,
"min": 0,
"avg": 0,
"max": 0
},
"model_sizes_bytes": {
"total": 0,
"min": 0,
"avg": 0,
"max": 0
},
"time_ms": {
"avg": 0
},
"count": 0
}
},
"node_count": 1
},
"monitoring": {
"available": true,
"enabled": true,
"collection_enabled": false,
"enabled_exporters": {
"local": 1
}
},
"rollup": {
"available": true,
"enabled": true
},
"searchable_snapshots": {
"available": false,
"enabled": true,
"indices_count": 0,
"full_copy_indices_count": 0,
"shared_cache_indices_count": 0
},
"security": {
"available": true,
"enabled": true,
"realms": {
"file": {
"name": [
"default_file"
],
"available": true,
"cache": [
{
"size": 0
}
],
"size": [
0
],
"enabled": true,
"order": [
-2147483648
]
},
"ldap": {
"available": false,
"enabled": false
},
"native": {
"name": [
"default_native"
],
"available": true,
"cache": [
{
"size": 0
}
],
"size": [
0
],
"enabled": true,
"order": [
-2147483648
]
},
"jwt": {
"available": false,
"enabled": false
},
"saml": {
"available": false,
"enabled": false
},
"kerberos": {
"available": false,
"enabled": false
},
"oidc": {
"available": false,
"enabled": false
},
"active_directory": {
"available": false,
"enabled": false
},
"pki": {
"available": false,
"enabled": false
}
},
"roles": {
"file": {
"dls": false,
"size": 0,
"fls": false
},
"native": {
"dls": false,
"size": 0,
"fls": false
},
"dls": {
"bit_set_cache": {
"memory_in_bytes": 0,
"memory": "0b",
"count": 0
}
}
},
"role_mapping": {
"native": {
"size": 0,
"enabled": 0
}
},
"ssl": {
"http": {
"enabled": true
},
"transport": {
"enabled": true
}
},
"token_service": {
"enabled": true
},
"api_key_service": {
"enabled": true
},
"audit": {
"enabled": false
},
"ipfilter": {
"http": false,
"transport": false
},
"anonymous": {
"enabled": false
},
"fips_140": {
"enabled": false
},
"operator_privileges": {
"enabled": false,
"available": false
}
},
"slm": {
"available": true,
"enabled": true
},
"spatial": {
"available": true,
"enabled": true
},
"sql": {
"available": true,
"enabled": true,
"features": {
"having": 0,
"subselect": 0,
"limit": 0,
"orderby": 0,
"where": 0,
"join": 0,
"groupby": 0,
"local": 0,
"command": 0
},
"queries": {
"cli": {
"total": 0,
"paging": 0,
"failed": 0
},
"rest": {
"total": 0,
"paging": 0,
"failed": 0
},
"canvas": {
"total": 0,
"paging": 0,
"failed": 0
},
"odbc": {
"total": 0,
"paging": 0,
"failed": 0
},
"jdbc": {
"total": 0,
"paging": 0,
"failed": 0
},
"odbc32": {
"total": 0,
"paging": 0,
"failed": 0
},
"odbc64": {
"total": 0,
"paging": 0,
"failed": 0
},
"translate": {
"count": 0
},
"_all": {
"total": 0,
"paging": 0,
"failed": 0
}
}
},
"transform": {
"available": true,
"enabled": true
},
"voting_only": {
"available": true,
"enabled": true
},
"watcher": {
"available": false,
"enabled": true,
"execution": {
"actions": {
"_all": {
"total": 0,
"total_time_in_ms": 0
}
}
},
"watch": {
"input": {
"_all": {
"total": 0,
"active": 0
}
},
"trigger": {
"_all": {
"total": 0,
"active": 0
}
}
},
"count": {
"total": 0,
"active": 0
}
},
"archive": {
"available": false,
"enabled": true,
"indices_count": 0
}
}
文章来源于互联网:Elasticsearch:Usage API
相关推荐: 在 Elasticsearch 中查找所需安全权限的简单方法
在 Elasticsearch 中很难找到严格安全所需的权限。 在本博客中,我将通过两个示例概述我用来查找所需权限的过程。 例子一 让我们创建一个只能与 index-* 索引和以index1 别名交互的用户。 他们将能够: 如果不存在则创建索引 将文档索引到索…