{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "search": {
      "type": "object",
      "properties": {
        "elasticsearch": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string",
                  "const": "elastic"
                },
                "cloudId": {
                  "type": "string",
                  "description": "Elastic.co CloudID See: https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/client-connecting.html#authentication"
                },
                "auth": {
                  "type": "object",
                  "properties": {
                    "username": {
                      "type": "string"
                    },
                    "password": {
                      "type": "string",
                      "visibility": "secret"
                    }
                  },
                  "required": [
                    "username",
                    "password"
                  ]
                },
                "indexPrefix": {
                  "type": "string",
                  "description": "Prefix to be used for all index creation. Value will be put in front of the index as is."
                },
                "batchSize": {
                  "type": "number",
                  "description": "Batch size for elastic search indexing tasks. Defaults to 1000."
                },
                "batchKeyField": {
                  "type": "string",
                  "description": "Defines the name of the field in each document that will be used to identify documents during a batch upload. If not provided, a custom ID will be generated for each document."
                },
                "highlightOptions": {
                  "type": "object",
                  "properties": {
                    "fragmentSize": {
                      "type": "number",
                      "description": "The size of the highlighted fragment in characters. Defaults to 1000."
                    },
                    "numFragments": {
                      "type": "number",
                      "description": "Number of result fragments to extract. Fragments will be concatenated with `fragmentDelimiter`. Defaults to 1."
                    },
                    "fragmentDelimiter": {
                      "type": "string",
                      "description": "Delimiter string used to concatenate fragments. Defaults to \" ... \"."
                    }
                  },
                  "description": "Options for configuring highlight settings See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/highlighting.html"
                },
                "queryOptions": {
                  "type": "object",
                  "properties": {
                    "fuzziness": {
                      "anyOf": [
                        {
                          "type": "string",
                          "const": "AUTO"
                        },
                        {
                          "type": "number"
                        }
                      ],
                      "description": "Fuzziness allows you to define the maximum Levenshtein distance for fuzzy queries, which determines how many single-character edits (insertions, deletions, substitutions) are allowed for a term to be considered a match.\n\n- 'AUTO': Automatically determines the fuzziness level based on the length of the term.           This is the default and widely accepted standard.\n- number: Specifies a fixed fuzziness level. For example, a value of 1 allows for one edit.\n\nExample:\n- For a term \"apple\" with fuzziness set to 1, queries like \"aple\" or \"apply\" would match."
                    },
                    "prefixLength": {
                      "type": "number",
                      "description": "Minimum number of characters that must match exactly at the beginning of the query. Defaults to 0."
                    }
                  }
                },
                "indexTemplates": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "body": {
                        "type": "object",
                        "properties": {
                          "index_patterns": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Array of wildcard (*) expressions used to match the names of data streams and indices during creation."
                          },
                          "composed_of": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "An ordered list of component template names. Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence."
                          },
                          "template": {
                            "type": "object",
                            "additionalProperties": {},
                            "description": "See available properties of template https://www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-put-template.html#put-index-template-api-request-body"
                          }
                        },
                        "required": [
                          "index_patterns"
                        ]
                      }
                    },
                    "required": [
                      "name",
                      "body"
                    ]
                  },
                  "description": "Elasticsearch specific index template bodies"
                },
                "clientOptions": {
                  "type": "object",
                  "properties": {
                    "ssl": {
                      "type": "object",
                      "properties": {
                        "rejectUnauthorized": {
                          "type": "boolean",
                          "description": "If true the server will reject any connection which is not authorized with the list of supplied CAs.",
                          "default": true
                        }
                      }
                    }
                  },
                  "description": "Miscellaneous options for the client"
                }
              },
              "required": [
                "auth",
                "cloudId",
                "provider"
              ]
            },
            {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string",
                  "const": "aws"
                },
                "node": {
                  "type": "string",
                  "description": "Node configuration. URL AWS ES endpoint to connect to. Eg. https://my-es-cluster.eu-west-1.es.amazonaws.com"
                },
                "region": {
                  "type": "string",
                  "description": "The AWS region. Only needed if using a custom DNS record."
                },
                "service": {
                  "type": "string",
                  "enum": [
                    "es",
                    "aoss"
                  ],
                  "description": "The AWS service used for request signature. Either 'es' for \"Managed Clusters\" or 'aoss' for \"Serverless\". Only needed if using a custom DNS record."
                },
                "indexPrefix": {
                  "type": "string",
                  "description": "Prefix to be used for all index creation. Value will be put in front of the index as is."
                },
                "batchSize": {
                  "type": "number",
                  "description": "Batch size for elastic search indexing tasks. Defaults to 1000."
                },
                "batchKeyField": {
                  "type": "string",
                  "description": "Defines the name of the field in each document that will be used to identify documents during a batch upload. If not provided, a custom ID will be generated for each document."
                },
                "highlightOptions": {
                  "type": "object",
                  "properties": {
                    "fragmentSize": {
                      "type": "number",
                      "description": "The size of the highlighted fragment in characters. Defaults to 1000."
                    },
                    "numFragments": {
                      "type": "number",
                      "description": "Number of result fragments to extract. Fragments will be concatenated with `fragmentDelimiter`. Defaults to 1."
                    },
                    "fragmentDelimiter": {
                      "type": "string",
                      "description": "Delimiter string used to concatenate fragments. Defaults to \" ... \"."
                    }
                  },
                  "description": "Options for configuring highlight settings See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/highlighting.html"
                },
                "queryOptions": {
                  "type": "object",
                  "properties": {
                    "fuzziness": {
                      "anyOf": [
                        {
                          "type": "string",
                          "const": "AUTO"
                        },
                        {
                          "type": "number"
                        }
                      ],
                      "description": "Fuzziness allows you to define the maximum Levenshtein distance for fuzzy queries, which determines how many single-character edits (insertions, deletions, substitutions) are allowed for a term to be considered a match.\n\n- 'AUTO': Automatically determines the fuzziness level based on the length of the term.           This is the default and widely accepted standard.\n- number: Specifies a fixed fuzziness level. For example, a value of 1 allows for one edit.\n\nExample:\n- For a term \"apple\" with fuzziness set to 1, queries like \"aple\" or \"apply\" would match."
                    },
                    "prefixLength": {
                      "type": "number",
                      "description": "Minimum number of characters that must match exactly at the beginning of the query. Defaults to 0."
                    }
                  }
                },
                "indexTemplates": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "body": {
                        "type": "object",
                        "properties": {
                          "index_patterns": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Array of wildcard (*) expressions used to match the names of data streams and indices during creation."
                          },
                          "composed_of": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "An ordered list of component template names. Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence."
                          },
                          "template": {
                            "type": "object",
                            "additionalProperties": {},
                            "description": "See available properties of template https://www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-put-template.html#put-index-template-api-request-body"
                          }
                        },
                        "required": [
                          "index_patterns"
                        ]
                      }
                    },
                    "required": [
                      "name",
                      "body"
                    ]
                  },
                  "description": "Elasticsearch specific index template bodies"
                },
                "clientOptions": {
                  "type": "object",
                  "properties": {
                    "ssl": {
                      "type": "object",
                      "properties": {
                        "rejectUnauthorized": {
                          "type": "boolean",
                          "description": "If true the server will reject any connection which is not authorized with the list of supplied CAs.",
                          "default": true
                        }
                      }
                    }
                  },
                  "description": "Miscellaneous options for the client"
                }
              },
              "required": [
                "node",
                "provider"
              ]
            },
            {
              "type": "object",
              "properties": {
                "node": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  ],
                  "description": "Node configuration. URL/URLS to ElasticSearch node to connect to. Either direct URL like 'https://localhost:9200' or with credentials like 'https://username:password@localhost:9200'"
                },
                "auth": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "username": {
                          "type": "string"
                        },
                        "password": {
                          "type": "string",
                          "visibility": "secret"
                        }
                      },
                      "required": [
                        "username",
                        "password"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "apiKey": {
                          "type": "string",
                          "description": "Base64 Encoded API key to be used to connect to the cluster. See: https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-create-api-key.html",
                          "visibility": "secret"
                        }
                      },
                      "required": [
                        "apiKey"
                      ]
                    }
                  ],
                  "description": "Authentication credentials for ElasticSearch If both ApiKey/Bearer token and username+password is provided, tokens take precedence"
                },
                "indexPrefix": {
                  "type": "string",
                  "description": "Prefix to be used for all index creation. Value will be put in front of the index as is."
                },
                "batchSize": {
                  "type": "number",
                  "description": "Batch size for elastic search indexing tasks. Defaults to 1000."
                },
                "batchKeyField": {
                  "type": "string",
                  "description": "Defines the name of the field in each document that will be used to identify documents during a batch upload. If not provided, a custom ID will be generated for each document."
                },
                "highlightOptions": {
                  "type": "object",
                  "properties": {
                    "fragmentSize": {
                      "type": "number",
                      "description": "The size of the highlighted fragment in characters. Defaults to 1000."
                    },
                    "numFragments": {
                      "type": "number",
                      "description": "Number of result fragments to extract. Fragments will be concatenated with `fragmentDelimiter`. Defaults to 1."
                    },
                    "fragmentDelimiter": {
                      "type": "string",
                      "description": "Delimiter string used to concatenate fragments. Defaults to \" ... \"."
                    }
                  },
                  "description": "Options for configuring highlight settings See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/highlighting.html"
                },
                "queryOptions": {
                  "type": "object",
                  "properties": {
                    "fuzziness": {
                      "anyOf": [
                        {
                          "type": "string",
                          "const": "AUTO"
                        },
                        {
                          "type": "number"
                        }
                      ],
                      "description": "Fuzziness allows you to define the maximum Levenshtein distance for fuzzy queries, which determines how many single-character edits (insertions, deletions, substitutions) are allowed for a term to be considered a match.\n\n- 'AUTO': Automatically determines the fuzziness level based on the length of the term.           This is the default and widely accepted standard.\n- number: Specifies a fixed fuzziness level. For example, a value of 1 allows for one edit.\n\nExample:\n- For a term \"apple\" with fuzziness set to 1, queries like \"aple\" or \"apply\" would match."
                    },
                    "prefixLength": {
                      "type": "number",
                      "description": "Minimum number of characters that must match exactly at the beginning of the query. Defaults to 0."
                    }
                  }
                },
                "indexTemplates": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "body": {
                        "type": "object",
                        "properties": {
                          "index_patterns": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Array of wildcard (*) expressions used to match the names of data streams and indices during creation."
                          },
                          "composed_of": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "An ordered list of component template names. Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence."
                          },
                          "template": {
                            "type": "object",
                            "additionalProperties": {},
                            "description": "See available properties of template https://www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-put-template.html#put-index-template-api-request-body"
                          }
                        },
                        "required": [
                          "index_patterns"
                        ]
                      }
                    },
                    "required": [
                      "name",
                      "body"
                    ]
                  },
                  "description": "Elasticsearch specific index template bodies"
                },
                "clientOptions": {
                  "type": "object",
                  "properties": {
                    "ssl": {
                      "type": "object",
                      "properties": {
                        "rejectUnauthorized": {
                          "type": "boolean",
                          "description": "If true the server will reject any connection which is not authorized with the list of supplied CAs.",
                          "default": true
                        }
                      }
                    }
                  },
                  "description": "Miscellaneous options for the client"
                }
              },
              "required": [
                "node"
              ]
            },
            {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string",
                  "const": "opensearch"
                },
                "node": {
                  "anyOf": [
                    {
                      "type": "string"
                    },
                    {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  ],
                  "description": "Node configuration. URL/URLS to OpenSearch node to connect to. Either direct URL like 'https://localhost:9200' or with credentials like 'https://username:password@localhost:9200'"
                },
                "auth": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "username": {
                          "type": "string"
                        },
                        "password": {
                          "type": "string",
                          "visibility": "secret"
                        }
                      },
                      "required": [
                        "username",
                        "password"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "apiKey": {
                          "type": "string",
                          "visibility": "secret"
                        }
                      },
                      "required": [
                        "apiKey"
                      ]
                    }
                  ],
                  "description": "Authentication credentials for OpenSearch If both ApiKey/Bearer token and username+password is provided, tokens take precedence"
                },
                "indexPrefix": {
                  "type": "string",
                  "description": "Prefix to be used for all index creation. Value will be put in front of the index as is."
                },
                "batchSize": {
                  "type": "number",
                  "description": "Batch size for elastic search indexing tasks. Defaults to 1000."
                },
                "batchKeyField": {
                  "type": "string",
                  "description": "Defines the name of the field in each document that will be used to identify documents during a batch upload. If not provided, a custom ID will be generated for each document."
                },
                "highlightOptions": {
                  "type": "object",
                  "properties": {
                    "fragmentSize": {
                      "type": "number",
                      "description": "The size of the highlighted fragment in characters. Defaults to 1000."
                    },
                    "numFragments": {
                      "type": "number",
                      "description": "Number of result fragments to extract. Fragments will be concatenated with `fragmentDelimiter`. Defaults to 1."
                    },
                    "fragmentDelimiter": {
                      "type": "string",
                      "description": "Delimiter string used to concatenate fragments. Defaults to \" ... \"."
                    }
                  },
                  "description": "Options for configuring highlight settings See https://www.elastic.co/guide/en/elasticsearch/reference/7.17/highlighting.html"
                },
                "queryOptions": {
                  "type": "object",
                  "properties": {
                    "fuzziness": {
                      "anyOf": [
                        {
                          "type": "string",
                          "const": "AUTO"
                        },
                        {
                          "type": "number"
                        }
                      ],
                      "description": "Fuzziness allows you to define the maximum Levenshtein distance for fuzzy queries, which determines how many single-character edits (insertions, deletions, substitutions) are allowed for a term to be considered a match.\n\n- 'AUTO': Automatically determines the fuzziness level based on the length of the term.           This is the default and widely accepted standard.\n- number: Specifies a fixed fuzziness level. For example, a value of 1 allows for one edit.\n\nExample:\n- For a term \"apple\" with fuzziness set to 1, queries like \"aple\" or \"apply\" would match."
                    },
                    "prefixLength": {
                      "type": "number",
                      "description": "Minimum number of characters that must match exactly at the beginning of the query. Defaults to 0."
                    }
                  }
                },
                "indexTemplates": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "body": {
                        "type": "object",
                        "properties": {
                          "index_patterns": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "Array of wildcard (*) expressions used to match the names of data streams and indices during creation."
                          },
                          "composed_of": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            },
                            "description": "An ordered list of component template names. Component templates are merged in the order specified, meaning that the last component template specified has the highest precedence."
                          },
                          "template": {
                            "type": "object",
                            "additionalProperties": {},
                            "description": "See available properties of template https://www.elastic.co/guide/en/elasticsearch/reference/7.15/indices-put-template.html#put-index-template-api-request-body"
                          }
                        },
                        "required": [
                          "index_patterns"
                        ]
                      }
                    },
                    "required": [
                      "name",
                      "body"
                    ]
                  },
                  "description": "Elasticsearch specific index template bodies"
                },
                "clientOptions": {
                  "type": "object",
                  "properties": {
                    "ssl": {
                      "type": "object",
                      "properties": {
                        "rejectUnauthorized": {
                          "type": "boolean",
                          "description": "If true the server will reject any connection which is not authorized with the list of supplied CAs.",
                          "default": true
                        }
                      }
                    }
                  },
                  "description": "Miscellaneous options for the client"
                }
              },
              "required": [
                "node",
                "provider"
              ]
            }
          ],
          "description": "Options for ElasticSearch"
        }
      },
      "description": "Configuration options for the search plugin"
    }
  }
}
