{
  "$schema" : "https://json-schema.org/draft/2020-12/schema",
  "$id" : "https://voltdb.com/voltsp/schemas/sink/elastic",
  "title" : "Elastic Sink Configuration",
  "description" : "The `elastic` sink is used to send data to an Elasticsearch cluster. It supports version 7 and 8 and uses\n official [low-level client](https://www.elastic.co/guide/en/elasticsearch/client/java-api-client/current/java-rest-low.html){target=\"_blank\"}\n with features such as:\n\n- load balancing across all available nodes\n- failover in case of node failures\n- persistent connections\n- SSL/TLS\n- bulk mode\n\nWhen the CA certificate is available as a PEM-encoded file, set `sink.elastic.ssl.trustStoreFileCa` in the configuration.\nNote that `trustStoreFileCa` cannot be used together with `trustStoreFile`. They are mutually exclusive.\n",
  "type" : "object",
  "properties" : {
    "elastic" : {
      "type" : "object",
      "properties" : {
        "indexName" : {
          "type" : "string",
          "description" : "Elasticsearch index name."
        },
        "address" : {
          "type" : "string",
          "description" : "Elasticsearch address [host:port].",
          "default" : "localhost:9200",
          "anyOf" : [ {
            "type" : "string",
            "format" : "hostname"
          }, {
            "type" : "string",
            "format" : "ipv4"
          }, {
            "type" : "string",
            "format" : "ipv6"
          } ]
        },
        "cacheSizeBytes" : {
          "type" : "integer",
          "description" : "Size of the request content size sent to Elasticsearch for bulk operations.",
          "default" : "5242880",
          "minimum" : -2147483648,
          "maximum" : 2147483647
        },
        "dataStream" : {
          "type" : "boolean",
          "description" : "In data stream mode, documents are indexed into a backing index managed by the data stream.\nEach document must include a `@timestamp` field, which is mapped as a `date` or `date_nanos` field type.\nIndexing operations are the primary workload, with only occasional updates or deletions.\nDocuments are typically indexed without specifying an `_id`; however, if an `_id` is provided,\nthe system assumes first-write-wins behavior, meaning existing documents with the same ID\nmay be silently overwritten.\n",
          "default" : "false"
        },
        "retry" : {
          "type" : "object",
          "description" : "Defines the retry policy, including the number of attempts and\nbackoff delays between retries after request failures.",
          "properties" : {
            "retries" : {
              "type" : "integer",
              "description" : "Number of retry attempts after a request failure.",
              "default" : "3",
              "minimum" : -2147483648,
              "maximum" : 2147483647
            },
            "backoffDelay" : {
              "type" : "string",
              "pattern" : "^(\\d+[smhd]|P(T|\\d+[YMD]).*)",
              "description" : "Initial delay before the first retry attempt.",
              "default" : "PT0.2S"
            },
            "maxBackoffDelay" : {
              "type" : "string",
              "pattern" : "^(\\d+[smhd]|P(T|\\d+[YMD]).*)",
              "description" : "Maximum delay between consecutive retry attempts.",
              "default" : "PT3S"
            }
          },
          "additionalProperties" : false
        },
        "auth" : {
          "type" : "object",
          "description" : "Elasticsearch authentication.",
          "properties" : {
            "username" : {
              "type" : "string",
              "description" : "Username used for authentication."
            },
            "password" : {
              "type" : "string",
              "description" : "Password used for authentication."
            }
          },
          "additionalProperties" : false
        },
        "ssl" : {
          "type" : "object",
          "description" : "Secure transport configuration.",
          "properties" : {
            "trustStoreFile" : {
              "type" : "string",
              "description" : "Truststore file or trusted CA certificate; supported formats include JKS, PKCS#12, or PEM."
            },
            "trustStorePassword" : {
              "type" : "string",
              "description" : "Truststore password."
            },
            "keyStoreFile" : {
              "type" : "string",
              "description" : "Keystore file; supported formats include JKS, PKCS#12, or PEM"
            },
            "keyStorePassword" : {
              "type" : "string",
              "description" : "Keystore password."
            },
            "keyPassword" : {
              "type" : "string",
              "description" : "Private key password. Optional — if not set, the key store password will be used."
            },
            "insecure" : {
              "type" : "boolean",
              "description" : "If set to true, disables SSL certificate and hostname validation.\nIntended for debugging purposes only. Doesn't work with mTLS.\n"
            },
            "hostnameVerifier" : {
              "type" : "string",
              "description" : "Custom hostname verifier for SSL connections.\nIf not specified and 'insecure' is true, hostname verification will be disabled.\n"
            }
          },
          "additionalProperties" : false
        },
        "exceptionHandler" : {
          "type" : "string",
          "description" : "Custom exception handler enabling interception of all errors related to this source."
        },
        "requestHeaders" : {
          "type" : "object",
          "description" : "Extra Elasticsearch client request headers.",
          "additionalProperties" : {
            "type" : "string"
          }
        },
        "requestParameters" : {
          "type" : "object",
          "description" : "Elasticsearch client request parameters.",
          "additionalProperties" : {
            "type" : "string"
          }
        }
      },
      "required" : [ "indexName", "address" ],
      "additionalProperties" : false
    }
  },
  "required" : [ "elastic" ],
  "additionalProperties" : false
}
