{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/elastic/json-schema/elastic-ccr-types-follow-index-stats-schema.json",
  "title": "ccr._types.FollowIndexStats",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/elastic-ccr-api-openapi.yml#/components/schemas/ccr._types.FollowIndexStats",
  "type": "object",
  "properties": {
    "index": {
      "description": "The name of the follower index.",
      "allOf": [
        {
          "$ref": "#/$defs/_types.IndexName"
        }
      ]
    },
    "shards": {
      "description": "An array of shard-level following task statistics.",
      "type": "array",
      "items": {
        "$ref": "#/$defs/ccr._types.ShardStats"
      }
    }
  },
  "required": [
    "index",
    "shards"
  ],
  "$defs": {
    "_types.ByteSize": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "string"
        }
      ]
    },
    "_types.Duration": {
      "description": "A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and\n`d` (days). Also accepts \"0\" without a unit and \"-1\" to indicate an unspecified value.",
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "string",
          "enum": [
            "-1"
          ]
        },
        {
          "type": "string",
          "enum": [
            "0"
          ]
        }
      ]
    },
    "_types.DurationValueUnitMillis": {
      "allOf": [
        {
          "$ref": "#/$defs/_types.UnitMillis"
        }
      ]
    },
    "_types.ErrorCause": {
      "description": "Cause and details about a request failure. This class defines the properties common to all error types.\nAdditional details are also provided, that depend on the error type.",
      "type": "object",
      "properties": {
        "type": {
          "description": "The type of error",
          "type": "string"
        },
        "reason": {
          "description": "A human-readable explanation of the error, in English.",
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": [
                "string",
                "null"
              ]
            }
          ]
        },
        "stack_trace": {
          "description": "The server stack trace. Present only if the `error_trace=true` parameter was sent with the request.",
          "type": "string"
        },
        "caused_by": {
          "allOf": [
            {
              "$ref": "#/$defs/_types.ErrorCause"
            }
          ]
        },
        "root_cause": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/_types.ErrorCause"
          }
        },
        "suppressed": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/_types.ErrorCause"
          }
        }
      },
      "required": [
        "type"
      ]
    },
    "_types.IndexName": {
      "type": "string"
    },
    "_types.SequenceNumber": {
      "type": "number"
    },
    "_types.UnitMillis": {
      "description": "Time unit for milliseconds",
      "type": "number"
    },
    "_types.VersionNumber": {
      "type": "number"
    },
    "ccr._types.ReadException": {
      "type": "object",
      "properties": {
        "exception": {
          "description": "The exception that caused the read to fail.",
          "allOf": [
            {
              "$ref": "#/$defs/_types.ErrorCause"
            }
          ]
        },
        "from_seq_no": {
          "description": "The starting sequence number of the batch requested from the leader.",
          "allOf": [
            {
              "$ref": "#/$defs/_types.SequenceNumber"
            }
          ]
        },
        "retries": {
          "description": "The number of times the batch has been retried.",
          "type": "number"
        }
      },
      "required": [
        "exception",
        "from_seq_no",
        "retries"
      ]
    },
    "ccr._types.ShardStats": {
      "type": "object",
      "properties": {
        "bytes_read": {
          "description": "The total of transferred bytes read from the leader.\nThis is only an estimate and does not account for compression if enabled.",
          "type": "number"
        },
        "failed_read_requests": {
          "description": "The number of failed reads.",
          "type": "number"
        },
        "failed_write_requests": {
          "description": "The number of failed bulk write requests on the follower.",
          "type": "number"
        },
        "fatal_exception": {
          "allOf": [
            {
              "$ref": "#/$defs/_types.ErrorCause"
            }
          ]
        },
        "follower_aliases_version": {
          "description": "The index aliases version the follower is synced up to.",
          "allOf": [
            {
              "$ref": "#/$defs/_types.VersionNumber"
            }
          ]
        },
        "follower_global_checkpoint": {
          "description": "The current global checkpoint on the follower.\nThe difference between the `leader_global_checkpoint` and the `follower_global_checkpoint` is an indication of how much the follower is lagging the leader.",
          "type": "number"
        },
        "follower_index": {
          "description": "The name of the follower index.",
          "type": "string"
        },
        "follower_mapping_version": {
          "description": "The mapping version the follower is synced up to.",
          "allOf": [
            {
              "$ref": "#/$defs/_types.VersionNumber"
            }
          ]
        },
        "follower_max_seq_no": {
          "description": "The current maximum sequence number on the follower.",
          "allOf": [
            {
              "$ref": "#/$defs/_types.SequenceNumber"
            }
          ]
        },
        "follower_settings_version": {
          "description": "The index settings version the follower is synced up to.",
          "allOf": [
            {
              "$ref": "#/$defs/_types.VersionNumber"
            }
          ]
        },
        "last_requested_seq_no": {
          "description": "The starting sequence number of the last batch of operations requested from the leader.",
          "allOf": [
            {
              "$ref": "#/$defs/_types.SequenceNumber"
            }
          ]
        },
        "leader_global_checkpoint": {
          "description": "The current global checkpoint on the leader known to the follower task.",
          "type": "number"
        },
        "leader_index": {
          "description": "The name of the index in the leader cluster being followed.",
          "type": "string"
        },
        "leader_max_seq_no": {
          "description": "The current maximum sequence number on the leader known to the follower task.",
          "allOf": [
            {
              "$ref": "#/$defs/_types.SequenceNumber"
            }
          ]
        },
        "operations_read": {
          "description": "The total number of operations read from the leader.",
          "type": "number"
        },
        "operations_written": {
          "description": "The number of operations written on the follower.",
          "type": "number"
        },
        "outstanding_read_requests": {
          "description": "The number of active read requests from the follower.",
          "type": "number"
        },
        "outstanding_write_requests": {
          "description": "The number of active bulk write requests on the follower.",
          "type": "number"
        },
        "read_exceptions": {
          "description": "An array of objects representing failed reads.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/ccr._types.ReadException"
          }
        },
        "remote_cluster": {
          "description": "The remote cluster containing the leader index.",
          "type": "string"
        },
        "shard_id": {
          "description": "The numerical shard ID, with values from 0 to one less than the number of replicas.",
          "type": "number"
        },
        "successful_read_requests": {
          "description": "The number of successful fetches.",
          "type": "number"
        },
        "successful_write_requests": {
          "description": "The number of bulk write requests run on the follower.",
          "type": "number"
        },
        "time_since_last_read": {
          "allOf": [
            {
              "$ref": "#/$defs/_types.Duration"
            }
          ]
        },
        "time_since_last_read_millis": {
          "description": "The number of milliseconds since a read request was sent to the leader.\nWhen the follower is caught up to the leader, this number will increase up to the configured `read_poll_timeout` at which point another read request will be sent to the leader.",
          "allOf": [
            {
              "$ref": "#/$defs/_types.DurationValueUnitMillis"
            }
          ]
        },
        "total_read_remote_exec_time": {
          "allOf": [
            {
              "$ref": "#/$defs/_types.Duration"
            }
          ]
        },
        "total_read_remote_exec_time_millis": {
          "description": "The total time reads spent running on the remote cluster.",
          "allOf": [
            {
              "$ref": "#/$defs/_types.DurationValueUnitMillis"
            }
          ]
        },
        "total_read_time": {
          "allOf": [
            {
              "$ref": "#/$defs/_types.Duration"
            }
          ]
        },
        "total_read_time_millis": {
          "description": "The total time reads were outstanding, measured from the time a read was sent to the leader to the time a reply was returned to the follower.",
          "allOf": [
            {
              "$ref": "#/$defs/_types.DurationValueUnitMillis"
            }
          ]
        },
        "total_write_time": {
          "allOf": [
            {
              "$ref": "#/$defs/_types.Duration"
            }
          ]
        },
        "total_write_time_millis": {
          "description": "The total time spent writing on the follower.",
          "allOf": [
            {
              "$ref": "#/$defs/_types.DurationValueUnitMillis"
            }
          ]
        },
        "write_buffer_operation_count": {
          "description": "The number of write operations queued on the follower.",
          "type": "number"
        },
        "write_buffer_size_in_bytes": {
          "description": "The total number of bytes of operations currently queued for writing.",
          "allOf": [
            {
              "$ref": "#/$defs/_types.ByteSize"
            }
          ]
        }
      },
      "required": [
        "bytes_read",
        "failed_read_requests",
        "failed_write_requests",
        "follower_aliases_version",
        "follower_global_checkpoint",
        "follower_index",
        "follower_mapping_version",
        "follower_max_seq_no",
        "follower_settings_version",
        "last_requested_seq_no",
        "leader_global_checkpoint",
        "leader_index",
        "leader_max_seq_no",
        "operations_read",
        "operations_written",
        "outstanding_read_requests",
        "outstanding_write_requests",
        "read_exceptions",
        "remote_cluster",
        "shard_id",
        "successful_read_requests",
        "successful_write_requests",
        "time_since_last_read_millis",
        "total_read_remote_exec_time_millis",
        "total_read_time_millis",
        "total_write_time_millis",
        "write_buffer_operation_count",
        "write_buffer_size_in_bytes"
      ]
    }
  }
}