diff --git a/openapi-converter/Cargo.lock b/openapi-converter/Cargo.lock index a216eaf9ab..08a0723242 100644 --- a/openapi-converter/Cargo.lock +++ b/openapi-converter/Cargo.lock @@ -17,6 +17,34 @@ version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +[[package]] +name = "argh" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab257697eb9496bf75526f0217b5ed64636a9cfafa78b8365c71bd283fcef93e" +dependencies = [ + "argh_derive", + "argh_shared", +] + +[[package]] +name = "argh_derive" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b382dbd3288e053331f03399e1db106c9fb0d8562ad62cb04859ae926f324fa6" +dependencies = [ + "argh_shared", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "argh_shared" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64cb94155d965e3d37ffbbe7cc5b82c3dd79dd33bd48e536f73d2cfb8d85506f" + [[package]] name = "autocfg" version = "1.1.0" @@ -47,6 +75,7 @@ name = "clients_schema_to_openapi" version = "0.1.0" dependencies = [ "anyhow", + "argh", "clients_schema", "convert_case", "either_n", diff --git a/openapi-converter/clients_schema_to_openapi/Cargo.toml b/openapi-converter/clients_schema_to_openapi/Cargo.toml index 88933866dc..fc83bf16ae 100644 --- a/openapi-converter/clients_schema_to_openapi/Cargo.toml +++ b/openapi-converter/clients_schema_to_openapi/Cargo.toml @@ -21,5 +21,7 @@ either_n = "0.2.0" regex = "1.8" maplit = "1.0" +argh = "0.1" + tracing = "0.1.37" tracing-subscriber = "0.3.16" diff --git a/openapi-converter/clients_schema_to_openapi/src/components.rs b/openapi-converter/clients_schema_to_openapi/src/components.rs index 29856c0788..4c997bc1e5 100644 --- a/openapi-converter/clients_schema_to_openapi/src/components.rs +++ b/openapi-converter/clients_schema_to_openapi/src/components.rs @@ -1,6 +1,6 @@ use openapiv3::{Components, Parameter, ReferenceOr, RequestBody, Response, Schema, StatusCode}; use clients_schema::{TypeDefinition, TypeName, TypeRegistry}; -use crate::schemas::SchemaName; +use crate::utils::SchemaName; pub struct TypesAndComponents<'a> { pub types: TypeRegistry<'a>, diff --git a/openapi-converter/clients_schema_to_openapi/src/lib.rs b/openapi-converter/clients_schema_to_openapi/src/lib.rs index c825ccb36b..654c4bec30 100644 --- a/openapi-converter/clients_schema_to_openapi/src/lib.rs +++ b/openapi-converter/clients_schema_to_openapi/src/lib.rs @@ -1,8 +1,10 @@ mod paths; mod schemas; mod components; +mod utils; -use std::io::Write; +use std::collections::HashSet; +use std::io::{BufWriter, Write}; use std::path::Path; use openapiv3::{Components, OpenAPI}; @@ -10,12 +12,25 @@ use clients_schema::{Endpoint, Model}; use crate::components::TypesAndComponents; pub fn convert_schema_file(path: impl AsRef, endpoint_filter: fn(e: &Endpoint) -> bool, out: impl Write) -> anyhow::Result<()> { - let file = std::fs::File::open(path)?; - let model: Model = serde_json::from_reader(file)?; - let openapi = convert_schema(&model, endpoint_filter)?; + // Parsing from a string is faster than using a buffered reader when there is a need for look-ahead + // See https://github.com/serde-rs/json/issues/160 + let json = &std::fs::read_to_string(path)?; + let json_deser = &mut serde_json::Deserializer::from_str(&json); + + let mut unused = HashSet::new(); + let model: Model = serde_ignored::deserialize(json_deser, |path| { + if let serde_ignored::Path::Map {parent: _, key} = path { + unused.insert(key); + } + })?; + if !unused.is_empty() { + let msg = unused.into_iter().collect::>().join(", "); + tracing::warn!("Unknown fields found in schema.json: {}", msg); + } - serde_json::to_writer_pretty(out, &openapi)?; + let openapi = convert_schema(&model, endpoint_filter)?; + //serde_json::to_writer_pretty(BufWriter::new(out), &openapi)?; Ok(()) } diff --git a/openapi-converter/clients_schema_to_openapi/src/main.rs b/openapi-converter/clients_schema_to_openapi/src/main.rs index fac749b699..d70c5b7b73 100644 --- a/openapi-converter/clients_schema_to_openapi/src/main.rs +++ b/openapi-converter/clients_schema_to_openapi/src/main.rs @@ -1,16 +1,27 @@ use tracing::Level; +use tracing_subscriber::fmt::format::FmtSpan; use tracing_subscriber::FmtSubscriber; +use argh::FromArgs; + + + + fn main() -> anyhow::Result<()> { + + let subscriber = FmtSubscriber::builder() + .with_writer(std::io::stderr) .with_max_level(Level::TRACE) + .with_span_events(FmtSpan::EXIT) .finish(); tracing::subscriber::set_global_default(subscriber)?; clients_schema_to_openapi::convert_schema_file( "../output/schema/schema-no-generics.json", - |e| e.name == "search", + |e| true, + //|e| e.name == "search", std::io::stdout() )?; diff --git a/openapi-converter/clients_schema_to_openapi/src/paths.rs b/openapi-converter/clients_schema_to_openapi/src/paths.rs index de4baa1f85..d050d358df 100644 --- a/openapi-converter/clients_schema_to_openapi/src/paths.rs +++ b/openapi-converter/clients_schema_to_openapi/src/paths.rs @@ -13,8 +13,13 @@ use crate::components::TypesAndComponents; /// pub fn add_endpoint(endpoint: &clients_schema::Endpoint, tac: &mut TypesAndComponents, out: &mut Paths) -> anyhow::Result<()> { - if endpoint.request.is_none() || endpoint.response.is_none() { - tracing::warn!("Endpoint {} is missing either request or response", &endpoint.name); + if endpoint.request.is_none() { + tracing::warn!("Endpoint {} is missing a request -- ignored", &endpoint.name); + return Ok(()); + } + + if endpoint.response.is_none() { + tracing::warn!("Endpoint {} is missing a response -- ignored", &endpoint.name); return Ok(()); } diff --git a/openapi-converter/clients_schema_to_openapi/src/schemas.rs b/openapi-converter/clients_schema_to_openapi/src/schemas.rs index 1ca6505150..f4b7d40091 100644 --- a/openapi-converter/clients_schema_to_openapi/src/schemas.rs +++ b/openapi-converter/clients_schema_to_openapi/src/schemas.rs @@ -4,90 +4,26 @@ use openapiv3::{AdditionalProperties, ArrayType, Discriminator, ExternalDocument use clients_schema::{Body, Enum, Interface, LiteralValueValue, PropertiesBody, Property, Request, Response, TypeAlias, TypeAliasVariants, TypeDefinition, TypeName, ValueOf}; use crate::components::TypesAndComponents; +use crate::utils::{ IntoSchema, SchemaName, ReferenceOrBoxed }; // A placeholder in components.schema to handle recursive types const SCHEMA_PLACEHOLDER: ReferenceOr = ReferenceOr::Reference { reference: String::new() }; -pub trait ReferenceOrBoxed { - fn boxed(self) -> ReferenceOr>; -} - -impl ReferenceOrBoxed for ReferenceOr { - fn boxed(self) -> ReferenceOr> { - match self { - ReferenceOr::Item(t) => ReferenceOr::Item(Box::new(t)), - ReferenceOr::Reference { reference } => ReferenceOr::Reference { reference }, - } - } -} - -pub trait SchemaName { - fn schema_name(&self) -> String; - fn schema_ref(&self) -> ReferenceOr; -} - -impl SchemaName for TypeName { - fn schema_name(&self) -> String { - format!("{}", self) - } - - fn schema_ref(&self) -> ReferenceOr { - ReferenceOr::Reference { - reference: format!("#/components/schemas/{}", self) - } - } -} - -pub trait IntoSchema { - fn into_schema(self) -> ReferenceOr; - fn into_schema_with_base(self, base: &clients_schema::BaseType) -> ReferenceOr where Self: Sized { - let mut result = self.into_schema(); - if let ReferenceOr::Item(ref mut schema) = &mut result { - fill_data_with_base(&mut schema.schema_data, base); - } - result - } - - fn into_schema_with_data_fn(self, f: fn (&mut SchemaData) -> ()) -> ReferenceOr where Self: Sized { - let mut result = self.into_schema(); - if let ReferenceOr::Item(ref mut schema) = &mut result { - f(&mut schema.schema_data); - } - result - } -} - -impl IntoSchema for SchemaKind { - fn into_schema(self) -> ReferenceOr { - ReferenceOr::Item(Schema { - schema_data: Default::default(), - schema_kind: self, - }) - } -} - -impl IntoSchema for Type { - fn into_schema(self) -> ReferenceOr { - ReferenceOr::Item(Schema { - schema_kind: SchemaKind::Type(self), - schema_data: Default::default(), - }) - } -} - -impl IntoSchema for ObjectType { - fn into_schema(self) -> ReferenceOr { - ReferenceOr::Item(Schema { - schema_kind: SchemaKind::Type(Type::Object(self)), - schema_data: Default::default(), - }) - } -} - +/// +/// Convert `schema.json` type and value definitions to OpenAPI schemas: +/// +/// The `convert_*` functions return a concrete schema and not a reference and do not store them in +/// the OpenAPI `components.schema`. This is the role of `for_type_name` hat creates and stores the +/// schema and returns a reference. +/// impl <'a> TypesAndComponents<'a> { + /// + /// Convert a value. Returns a schema reference and not a concrete schema, as values can + /// be simple references to types. + /// pub fn convert_value_of(&mut self, value_of: &ValueOf) -> anyhow::Result> { Ok(match value_of { @@ -139,7 +75,7 @@ impl <'a> TypesAndComponents<'a> { // Single key dictionaries have exactly one property min_properties: if dict.single_key { Some(1) } else { None }, max_properties: if dict.single_key { Some(1) } else { None }, - }.into_schema() + }.into_schema_ref() }, // @@ -176,9 +112,9 @@ impl <'a> TypesAndComponents<'a> { }) } - // - // Return the reference for a type name, registering it if needed - // + /// + /// Return the reference for a type name, registering it if needed + /// pub fn for_type_name(&mut self, type_name: &TypeName) -> anyhow::Result> { let schema_name = type_name.schema_name(); @@ -197,17 +133,17 @@ impl <'a> TypesAndComponents<'a> { enumeration: vec![], min_length: None, max_length: None, - }).into_schema()) + }).into_schema_ref()) }, "boolean" => { - Ok(Type::Boolean {}.into_schema()) + Ok(Type::Boolean {}.into_schema_ref()) }, "number" => { - Ok(Type::Number(NumberType::default()).into_schema()) + Ok(Type::Number(NumberType::default()).into_schema_ref()) }, "void" => { // Empty object - Ok(ObjectType::default().into_schema()) + Ok(ObjectType::default().into_schema_ref()) }, "null" => { // Note that there is no null type; instead, the nullable attribute is used as a modifier of the base type. @@ -220,7 +156,11 @@ impl <'a> TypesAndComponents<'a> { enumeration: vec![], min_length: None, max_length: None, - }).into_schema_with_data_fn(|data| { data.nullable = true; })) + }).into_schema_ref_with_data_fn(|data| { data.nullable = true; })) + }, + "binary" => { + // FIXME: must be handled in requests and responses + Ok(ObjectType::default().into_schema_ref()) } _ => bail!("unknown builtin type: {}", type_name), } @@ -229,7 +169,7 @@ impl <'a> TypesAndComponents<'a> { if type_name.namespace == "_types" { match type_name.name.as_str() { "double" | "long" | "integer" | "float" => { - return Ok(Type::Number(NumberType::default()).into_schema()); + return Ok(Type::Number(NumberType::default()).into_schema_ref()); }, _ => {}, } @@ -245,9 +185,9 @@ impl <'a> TypesAndComponents<'a> { Request(_) => bail!("Requests should be handled using for_request"), Response(_) => bail!("Responses should be handled using for_request"), - Enum(enumm) => self.convert_enum(enumm)?, - Interface(itf) => self.convert_interface_definition(itf)?, - TypeAlias(alias) => self.convert_type_alias(alias)?, + Enum(enumm) => self.convert_enum(enumm)?.into_schema_ref(), + Interface(itf) => self.convert_interface_definition(itf)?.into_schema_ref(), + TypeAlias(alias) => self.convert_type_alias(alias)?.into_schema_ref(), }; Ok(self.add_schema(type_name, schema)) @@ -274,7 +214,7 @@ impl <'a> TypesAndComponents<'a> { additional_properties: None, min_properties: None, max_properties: None, - }.into_schema()) + }.into_schema_ref()) } }; @@ -283,6 +223,7 @@ impl <'a> TypesAndComponents<'a> { fn convert_property(&mut self, prop: &Property) -> anyhow::Result> { let mut result = self.convert_value_of(&prop.typ)?; + // TODO: how can we just wrap a reference so that we can add docs? if let ReferenceOr::Item(ref mut schema) = &mut result { fill_data_with_prop(&mut schema.schema_data, prop); } @@ -301,10 +242,10 @@ impl <'a> TypesAndComponents<'a> { props.filter_map(|prop| prop.required.then(|| prop.name.clone())).collect() } - // - // Register an interface definition and return the schema reference. - // - fn convert_interface_definition(&mut self, itf: &Interface) -> anyhow::Result> { + /// + /// Convert an interface definition into a schema + /// + fn convert_interface_definition(&mut self, itf: &Interface) -> anyhow::Result { let mut schema = if let Some(container) = &itf.variants { // TODO: interface definition container.non_exhaustive @@ -332,10 +273,10 @@ impl <'a> TypesAndComponents<'a> { additional_properties: None, min_properties: None, max_properties: None, - }.into_schema(); + }.into_schema_ref(); schema = SchemaKind::AllOf { - all_of: vec![container_props_schema, schema], + all_of: vec![container_props_schema, schema.into_schema_ref()], }.into_schema(); } @@ -357,7 +298,7 @@ impl <'a> TypesAndComponents<'a> { // Inheritance if let Some(inherit) = &itf.inherits { schema = SchemaKind::AllOf { - all_of: vec![self.for_type_name(&inherit.typ)?, schema], + all_of: vec![self.for_type_name(&inherit.typ)?, schema.into_schema_ref()], }.into_schema(); } @@ -380,20 +321,15 @@ impl <'a> TypesAndComponents<'a> { } } Ok(schema) - // FIXME: implements } - // - // Register a type alias and return the schema reference. - // - fn convert_type_alias(&mut self, alias: &TypeAlias) -> anyhow::Result> { - - let mut schema = self.convert_value_of(&alias.typ)?; - - // Add docs, etc. - if let ReferenceOr::Item(ref mut schema) = &mut schema { - schema.schema_data = convert_base_type(&alias.base); - } + /// + /// Creates alias an alias that references another type. + /// + fn convert_type_alias(&mut self, alias: &TypeAlias) -> anyhow::Result { + let mut schema = self + .convert_value_of(&alias.typ)? + .into_schema_with_base(&alias.base); match &alias.variants { None => {}, @@ -401,24 +337,22 @@ impl <'a> TypesAndComponents<'a> { // TODO: typed-keys: add an extension to identify it? }, Some(TypeAliasVariants::InternalTag(tag)) => { - if let ReferenceOr::Item(ref mut schema) = &mut schema { - // TODO: add tag.default_tag as an extension - schema.schema_data.discriminator = Some(Discriminator { - property_name: tag.tag.clone(), - mapping: Default::default(), - extensions: Default::default(), - }); - } + // TODO: add tag.default_tag as an extension + schema.schema_data.discriminator = Some(Discriminator { + property_name: tag.tag.clone(), + mapping: Default::default(), + extensions: Default::default(), + }); }, }; Ok(schema) } - // - // Register an enumeration and return the schema reference. - // - fn convert_enum(&mut self, enumm: &Enum) -> anyhow::Result> { + /// + /// Register an enumeration and return the schema reference. + /// + fn convert_enum(&mut self, enumm: &Enum) -> anyhow::Result { // TODO: enum.is_open @@ -426,37 +360,21 @@ impl <'a> TypesAndComponents<'a> { Some(m.name.clone()) }).collect::>(); - let schema = ReferenceOr::Item(Schema { - schema_data: convert_base_type(&enumm.base), - schema_kind: SchemaKind::Type(Type::String(StringType { - format: Default::default(), - pattern: None, - enumeration: enum_values, - min_length: None, - max_length: None, - })), - }); - - Ok(schema) + Ok(StringType { + format: Default::default(), + pattern: None, + enumeration: enum_values, + min_length: None, + max_length: None, + }.into_schema_with_base(&enumm.base)) } } -// -// Convert common type information. -// -fn convert_base_type(base: &clients_schema::BaseType) -> SchemaData { - let mut result = SchemaData::default(); - fill_data_with_base(&mut result, base); - return result; -} - -fn fill_schema_with_base(schema: &mut ReferenceOr, base: &clients_schema::BaseType) { - if let ReferenceOr::Item(ref mut schema) = schema { - fill_data_with_base(&mut schema.schema_data, base); - } +fn fill_schema_with_base(schema: &mut Schema, base: &clients_schema::BaseType) { + fill_data_with_base(&mut schema.schema_data, base); } -fn fill_data_with_base(data: &mut SchemaData, base: &clients_schema::BaseType) { +pub fn fill_data_with_base(data: &mut SchemaData, base: &clients_schema::BaseType) { // SchemaData { // nullable: false, // read_only: false, diff --git a/openapi-converter/clients_schema_to_openapi/src/utils.rs b/openapi-converter/clients_schema_to_openapi/src/utils.rs new file mode 100644 index 0000000000..be4e49e20d --- /dev/null +++ b/openapi-converter/clients_schema_to_openapi/src/utils.rs @@ -0,0 +1,138 @@ +use openapiv3::{ObjectType, ReferenceOr, Schema, SchemaData, SchemaKind, StringType, Type}; +use clients_schema::TypeName; + +/// +/// Extensions to `ReferenceOr` to ease conversion to boxed versions. +/// +pub trait ReferenceOrBoxed { + fn boxed(self) -> ReferenceOr>; +} + +impl ReferenceOrBoxed for ReferenceOr { + fn boxed(self) -> ReferenceOr> { + match self { + ReferenceOr::Item(t) => ReferenceOr::Item(Box::new(t)), + ReferenceOr::Reference { reference } => ReferenceOr::Reference { reference }, + } + } +} + +/// +/// Extension to `TypeName` to return its name as an OpenAPI schema +/// +pub trait SchemaName { + /// Name in the `#/components/schema` section + fn schema_name(&self) -> String; + /// Full reference + fn schema_ref(&self) -> ReferenceOr; +} + +impl SchemaName for TypeName { + fn schema_name(&self) -> String { + format!("{}", self) + } + + fn schema_ref(&self) -> ReferenceOr { + ReferenceOr::Reference { + reference: format!("#/components/schemas/{}", self) + } + } +} + +/// +/// Convenience extensions to turn OpenAPI type declarations into a `ReferenceOr`. +/// This avoids a lot of boiler plate when creating schema objects. +/// +pub trait IntoSchema { + fn into_schema_ref(self) -> ReferenceOr where Self: Sized{ + ReferenceOr::Item(self.into_schema()) + } + + fn into_schema_ref_with_base(self, base: &clients_schema::BaseType) -> ReferenceOr where Self: Sized { + let mut result = self.into_schema_ref(); + if let ReferenceOr::Item(ref mut schema) = &mut result { + crate::schemas::fill_data_with_base(&mut schema.schema_data, base); + } + result + } + + fn into_schema_ref_with_data_fn(self, f: fn (&mut SchemaData) -> ()) -> ReferenceOr where Self: Sized { + let mut result = self.into_schema_ref(); + if let ReferenceOr::Item(ref mut schema) = &mut result { + f(&mut schema.schema_data); + } + result + } + + fn into_schema_with_base(self, base: &clients_schema::BaseType) -> Schema where Self: Sized { + let mut schema = self.into_schema(); + crate::schemas::fill_data_with_base(&mut schema.schema_data, base); + schema + } + + fn into_schema_with_data_fn(self, f: fn (&mut SchemaData) -> ()) -> Schema where Self: Sized { + let mut schema = self.into_schema(); + f(&mut schema.schema_data); + schema + } + + fn into_schema(self) -> Schema; +} + +impl IntoSchema for Schema { + fn into_schema(self) -> Schema { + self + } +} + +impl IntoSchema for ReferenceOr { + fn into_schema_ref(self) -> ReferenceOr where Self: Sized { + self + } + + fn into_schema(self) -> Schema { + match self { + ReferenceOr::Item(schema) => schema, + ReferenceOr::Reference { .. } => SchemaKind::AllOf { + all_of: vec![self] + }.into_schema() + } + } +} + + +impl IntoSchema for SchemaKind { + fn into_schema(self) -> Schema { + Schema { + schema_data: Default::default(), + schema_kind: self, + } + } +} + +impl IntoSchema for Type { + fn into_schema(self) -> Schema { + Schema { + schema_kind: SchemaKind::Type(self), + schema_data: Default::default(), + } + } +} + +impl IntoSchema for ObjectType { + fn into_schema(self) -> Schema { + Schema { + schema_kind: SchemaKind::Type(Type::Object(self)), + schema_data: Default::default(), + } + } +} + +impl IntoSchema for StringType { + fn into_schema(self) -> Schema { + Schema { + schema_kind: SchemaKind::Type(Type::String(self)), + schema_data: Default::default(), + } + } +} diff --git a/openapi-converter/openapi_to_clients_schema/fixtures/enterprise-search.json b/openapi-converter/openapi_to_clients_schema/fixtures/enterprise-search.json index bd9001aa57..e69de29bb2 100644 --- a/openapi-converter/openapi_to_clients_schema/fixtures/enterprise-search.json +++ b/openapi-converter/openapi_to_clients_schema/fixtures/enterprise-search.json @@ -1,1423 +0,0 @@ -{ - "openapi": "3.0.2", - "info": { - "title": "Enterprise Search API V1", - "description": "A set of solution-wide APIs for managing Elastic Enterprise Search", - "version": "v1", - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - } - }, - "servers": [ - { - "url": "{schemes}://{host}:{port}", - "variables": { - "schemes": { - "enum": [ - "http", - "https" - ], - "default": "http" - }, - "host": { - "default": "localhost", - "description": "The host running Enterprise Search" - }, - "port": { - "default": "3002" - } - } - } - ], - "components": { - "securitySchemes": { - "bearer_auth": { - "type": "apiKey", - "in": "header", - "name": "Authorization" - }, - "basic_auth": { - "type": "http", - "scheme": "basic" - } - }, - "schemas": { - "version": { - "type": "object", - "additionalProperties": false, - "required": [ - "build_date", - "build_hash", - "number" - ], - "properties": { - "number": { - "type": "string" - }, - "build_hash": { - "type": "string" - }, - "build_date": { - "type": "string", - "nullable": true - } - } - }, - "memory_usage": { - "type": "object", - "additionalProperties": false, - "required": [ - "heap_committed", - "heap_init", - "heap_max", - "heap_used", - "non_heap_committed", - "non_heap_init", - "object_pending_finalization_count" - ], - "properties": { - "heap_init": { - "type": "integer" - }, - "heap_used": { - "type": "integer" - }, - "heap_committed": { - "type": "integer" - }, - "heap_max": { - "type": "integer" - }, - "non_heap_init": { - "type": "integer" - }, - "non_heap_committed": { - "type": "integer" - }, - "object_pending_finalization_count": { - "type": "integer" - } - } - }, - "thread_stats": { - "type": "object", - "additionalProperties": false, - "required": [ - "daemon_thread_count", - "peak_thread_count", - "thread_count", - "total_started_thread_count" - ], - "properties": { - "thread_count": { - "type": "integer" - }, - "peak_thread_count": { - "type": "integer" - }, - "total_started_thread_count": { - "type": "integer" - }, - "daemon_thread_count": { - "type": "integer" - } - } - }, - "jvm_gc_collector_info": { - "type": "object", - "additionalProperties": { - "type": "object", - "properties": { - "collection_count": { - "type": "integer" - }, - "collection_time": { - "type": "integer" - } - } - } - }, - "java_gc_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "collection_count", - "collection_time", - "garbage_collectors" - ], - "properties": { - "collection_count": { - "type": "integer" - }, - "collection_time": { - "type": "integer" - }, - "garbage_collectors": { - "$ref": "#/components/schemas/jvm_gc_collector_info" - } - } - }, - "jvm_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "memory_pools", - "memory_usage", - "pid", - "threads", - "gc", - "uptime", - "vm_name", - "vm_vendor", - "vm_version" - ], - "properties": { - "pid": { - "type": "integer" - }, - "uptime": { - "type": "integer" - }, - "memory_usage": { - "$ref": "#/components/schemas/memory_usage" - }, - "memory_pools": { - "type": "array", - "items": { - "type": "string" - } - }, - "threads": { - "$ref": "#/components/schemas/thread_stats" - }, - "vm_version": { - "type": "string" - }, - "vm_vendor": { - "type": "string" - }, - "vm_name": { - "type": "string" - }, - "gc": { - "$ref": "#/components/schemas/java_gc_info" - } - } - }, - "sidecar_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "alive" - ], - "properties": { - "pid": { - "type": "integer" - }, - "alive": { - "type": "boolean" - }, - "restart_count": { - "type": "integer" - }, - "seconds_since_last_restart": { - "type": "integer" - } - } - }, - "system_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "java_version", - "jruby_version", - "os_name", - "os_version" - ], - "properties": { - "java_version": { - "type": "string" - }, - "jruby_version": { - "type": "string" - }, - "os_name": { - "type": "string" - }, - "os_version": { - "type": "string" - } - } - }, - "esqueues_me_job_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "created_at", - "scheduled_at", - "processing_started_at", - "processing_latency", - "time_since_last_scheduled", - "time_since_last_processed", - "total_processed" - ], - "properties": { - "created_at": { - "type": "string", - "format": "date-time" - }, - "scheduled_at": { - "type": "string", - "format": "date-time" - }, - "processing_started_at": { - "type": "string", - "format": "date-time" - }, - "processing_latency": { - "type": "integer" - }, - "time_since_last_scheduled": { - "type": "integer" - }, - "time_since_last_processed": { - "type": "integer" - }, - "total_processed": { - "type": "integer" - } - } - }, - "esqueues_me_info": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/esqueues_me_job_info" - }, - "properties": { - "instance": { - "$ref": "#/components/schemas/esqueues_me_job_info" - } - } - }, - "crawler_workers_pool_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "pool_size", - "active", - "available" - ], - "properties": { - "pool_size": { - "type": "integer" - }, - "active": { - "type": "integer" - }, - "available": { - "type": "integer" - } - } - }, - "crawler_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "running", - "workers" - ], - "properties": { - "running": { - "type": "boolean" - }, - "workers": { - "$ref": "#/components/schemas/crawler_workers_pool_info" - } - } - }, - "storage_summary": { - "type": "object", - "additionalProperties": false, - "required": [ - "index_count", - "size_in_bytes" - ], - "properties": { - "index_count": { - "type": "integer", - "format": "int64" - }, - "size_in_bytes": { - "type": "integer", - "format": "int64" - } - } - }, - "index_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "name", - "size_in_bytes" - ], - "properties": { - "name": { - "type": "string" - }, - "size_in_bytes": { - "type": "integer", - "format": "int64" - } - } - }, - "storage_cleanup_response": { - "type": "object", - "additionalProperties": false, - "required": [ - "indices", - "index_count" - ], - "properties": { - "indices": { - "type": "array", - "items": { - "type": "string" - } - }, - "index_count": { - "type": "integer", - "format": "int64" - } - } - }, - "storage_response": { - "type": "object", - "additionalProperties": false, - "required": [ - "indices", - "summary" - ], - "properties": { - "indices": { - "type": "array", - "items": { - "$ref": "#/components/schemas/index_info" - } - }, - "summary": { - "$ref": "#/components/schemas/storage_summary" - } - } - }, - "health_response": { - "type": "object", - "additionalProperties": false, - "required": [ - "filebeat", - "jvm", - "name", - "system", - "version", - "cluster_uuid" - ], - "properties": { - "name": { - "type": "string" - }, - "cluster_uuid": { - "type": "string" - }, - "version": { - "$ref": "#/components/schemas/version" - }, - "jvm": { - "$ref": "#/components/schemas/jvm_info" - }, - "filebeat": { - "$ref": "#/components/schemas/sidecar_info" - }, - "metricbeat": { - "$ref": "#/components/schemas/sidecar_info" - }, - "system": { - "$ref": "#/components/schemas/system_info" - }, - "esqueues_me": { - "$ref": "#/components/schemas/esqueues_me_info" - }, - "crawler": { - "$ref": "#/components/schemas/crawler_info" - } - } - }, - "timer": { - "type": "object", - "additionalProperties": false, - "required": [ - "max", - "mean", - "sum" - ], - "properties": { - "sum": { - "type": "number" - }, - "max": { - "type": "number" - }, - "mean": { - "type": "number" - } - } - }, - "app_metrics": { - "type": "object", - "additionalProperties": { - "anyOf": [ - { - "type": "integer" - }, - { - "$ref": "#/components/schemas/timer" - } - ] - } - }, - "connections": { - "type": "object", - "required": [ - "current", - "max", - "total" - ], - "additionalProperties": false, - "properties": { - "current": { - "type": "integer", - "format": "int64" - }, - "max": { - "type": "integer", - "format": "int64" - }, - "total": { - "type": "integer", - "format": "int64" - } - } - }, - "request_duration_ms": { - "type": "object", - "required": [ - "max", - "mean", - "std_dev" - ], - "additionalProperties": false, - "properties": { - "max": { - "type": "integer", - "format": "int64" - }, - "mean": { - "type": "number", - "format": "double" - }, - "std_dev": { - "type": "number", - "format": "double" - } - } - }, - "network_bytes": { - "type": "object", - "required": [ - "received_total", - "received_rate", - "sent_total", - "sent_rate" - ], - "additionalProperties": false, - "properties": { - "received_total": { - "type": "integer", - "format": "int64" - }, - "received_rate": { - "type": "integer", - "format": "int64" - }, - "sent_total": { - "type": "integer", - "format": "int64" - }, - "sent_rate": { - "type": "integer", - "format": "int64" - } - } - }, - "responses": { - "type": "object", - "required": [ - "1xx", - "2xx", - "3xx", - "4xx", - "5xx" - ], - "additionalProperties": false, - "properties": { - "1xx": { - "type": "integer", - "format": "int64" - }, - "2xx": { - "type": "integer", - "format": "int64" - }, - "3xx": { - "type": "integer", - "format": "int64" - }, - "4xx": { - "type": "integer", - "format": "int64" - }, - "5xx": { - "type": "integer", - "format": "int64" - } - } - }, - "http_stats": { - "type": "object", - "required": [ - "connections", - "request_duration_ms", - "network_bytes", - "responses" - ], - "additionalProperties": false, - "properties": { - "connections": { - "$ref": "#/components/schemas/connections" - }, - "request_duration_ms": { - "$ref": "#/components/schemas/request_duration_ms" - }, - "network_bytes": { - "$ref": "#/components/schemas/network_bytes" - }, - "responses": { - "$ref": "#/components/schemas/responses" - } - } - }, - "app_stats": { - "type": "object", - "additionalProperties": false, - "required": [ - "end", - "metrics", - "pid", - "start" - ], - "properties": { - "pid": { - "type": "integer" - }, - "start": { - "type": "string" - }, - "end": { - "type": "string" - }, - "metrics": { - "$ref": "#/components/schemas/app_metrics" - } - } - }, - "queue_progress": { - "type": "object", - "additionalProperties": false, - "required": [ - "pending" - ], - "properties": { - "pending": { - "type": "integer" - } - } - }, - "queue_stats": { - "type": "object", - "required": [ - "failed" - ], - "properties": { - "failed": { - "type": "array", - "items": { - "type": "object" - } - } - }, - "additionalProperties": { - "$ref": "#/components/schemas/queue_progress" - } - }, - "connector_pool": { - "type": "object", - "additionalProperties": false, - "required": [ - "busy", - "idle", - "queue_depth", - "running", - "size", - "total_completed", - "total_scheduled" - ], - "properties": { - "running": { - "type": "boolean" - }, - "queue_depth": { - "type": "integer" - }, - "size": { - "type": "integer" - }, - "busy": { - "type": "integer" - }, - "idle": { - "type": "integer" - }, - "total_scheduled": { - "type": "integer" - }, - "total_completed": { - "type": "integer" - } - } - }, - "connector_pools": { - "type": "object", - "additionalProperties": false, - "required": [ - "extract_worker_pool", - "publish_worker_pool", - "subextract_worker_pool" - ], - "properties": { - "extract_worker_pool": { - "$ref": "#/components/schemas/connector_pool" - }, - "subextract_worker_pool": { - "$ref": "#/components/schemas/connector_pool" - }, - "publish_worker_pool": { - "$ref": "#/components/schemas/connector_pool" - } - } - }, - "job_types": { - "type": "object", - "additionalProperties": false, - "required": [ - "delete", - "full", - "incremental", - "permissions" - ], - "properties": { - "full": { - "type": "integer" - }, - "incremental": { - "type": "integer" - }, - "delete": { - "type": "integer" - }, - "permissions": { - "type": "integer" - } - } - }, - "job_store": { - "type": "object", - "additionalProperties": false, - "required": [ - "job_types", - "waiting", - "working" - ], - "properties": { - "waiting": { - "type": "integer" - }, - "working": { - "type": "integer" - }, - "job_types": { - "$ref": "#/components/schemas/job_types" - } - } - }, - "connector_stats": { - "type": "object", - "additionalProperties": false, - "required": [ - "alive", - "job_store", - "pool" - ], - "properties": { - "alive": { - "type": "boolean" - }, - "pool": { - "$ref": "#/components/schemas/connector_pools" - }, - "job_store": { - "$ref": "#/components/schemas/job_store" - } - } - }, - "app_search_product_usage_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "total_engines" - ], - "properties": { - "total_engines": { - "type": "integer" - } - } - }, - "workplace_search_product_usage_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "total_org_sources", - "total_private_sources", - "total_queries_last_30_days" - ], - "properties": { - "total_org_sources": { - "type": "integer" - }, - "total_private_sources": { - "type": "integer" - }, - "total_queries_last_30_days": { - "type": "integer" - } - } - }, - "enterprise_search_product_usage_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "total_search_indices" - ], - "properties": { - "total_search_indices": { - "type": "integer" - } - } - }, - "product_usage_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "app_search", - "workplace_search", - "enterprise_search" - ], - "properties": { - "app_search": { - "$ref": "#/components/schemas/app_search_product_usage_info" - }, - "workplace_search": { - "$ref": "#/components/schemas/workplace_search_product_usage_info" - }, - "enterprise_search": { - "$ref": "#/components/schemas/enterprise_search_product_usage_info" - } - } - }, - "crawler_crawl_requests_stats": { - "type": "object", - "additionalProperties": false, - "required": [ - "pending", - "active", - "successful", - "failed" - ], - "properties": { - "pending": { - "type": "integer" - }, - "active": { - "type": "integer" - }, - "successful": { - "type": "integer" - }, - "failed": { - "type": "integer" - } - } - }, - "crawler_global_stats": { - "type": "object", - "additionalProperties": false, - "required": [ - "crawl_requests" - ], - "properties": { - "crawl_requests": { - "$ref": "#/components/schemas/crawler_crawl_requests_stats" - } - } - }, - "crawler_denied_urls_info": { - "type": "object", - "additionalProperties": { - "type": "integer" - } - }, - "crawler_status_codes_info": { - "type": "object", - "additionalProperties": { - "type": "integer" - } - }, - "crawler_workers_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "pool_size", - "active", - "available" - ], - "properties": { - "pool_size": { - "type": "integer" - }, - "active": { - "type": "integer" - }, - "available": { - "type": "integer" - } - } - }, - "crawler_queue_sizes_info": { - "type": "object", - "additionalProperties": false, - "required": [ - "primary", - "purge" - ], - "properties": { - "primary": { - "type": "integer" - }, - "purge": { - "type": "integer" - } - } - }, - "crawler_node_stats": { - "type": "object", - "additionalProperties": false, - "required": [ - "pages_visited", - "urls_allowed", - "urls_denied", - "status_codes", - "queue_size", - "active_threads", - "workers" - ], - "properties": { - "active_threads": { - "type": "integer" - }, - "pages_visited": { - "type": "integer" - }, - "urls_allowed": { - "type": "integer" - }, - "queue_size": { - "$ref": "#/components/schemas/crawler_queue_sizes_info" - }, - "urls_denied": { - "$ref": "#/components/schemas/crawler_denied_urls_info" - }, - "status_codes": { - "$ref": "#/components/schemas/crawler_status_codes_info" - }, - "workers": { - "$ref": "#/components/schemas/crawler_workers_info" - } - } - }, - "crawler_stats": { - "type": "object", - "additionalProperties": false, - "required": [ - "global", - "node" - ], - "properties": { - "global": { - "$ref": "#/components/schemas/crawler_global_stats" - }, - "node": { - "$ref": "#/components/schemas/crawler_node_stats" - } - } - }, - "stats_response": { - "type": "object", - "additionalProperties": false, - "required": [ - "cluster_uuid", - "http", - "app", - "queues", - "connectors" - ], - "properties": { - "cluster_uuid": { - "type": "string" - }, - "http": { - "$ref": "#/components/schemas/http_stats" - }, - "app": { - "$ref": "#/components/schemas/app_stats" - }, - "queues": { - "$ref": "#/components/schemas/queue_stats" - }, - "connectors": { - "$ref": "#/components/schemas/connector_stats" - }, - "crawler": { - "$ref": "#/components/schemas/crawler_stats" - }, - "product_usage": { - "$ref": "#/components/schemas/product_usage_info" - } - } - }, - "read_only_state": { - "type": "object", - "additionalProperties": false, - "required": [ - "enabled" - ], - "properties": { - "enabled": { - "type": "boolean" - } - } - } - }, - "parameters": { - "force": { - "description": "The value for the \"force\" flag", - "in": "query", - "name": "force", - "schema": { - "type": "boolean" - } - }, - "included_stats": { - "name": "include", - "in": "query", - "schema": { - "type": "array", - "items": { - "type": "string" - } - }, - "required": false, - "style": "form", - "explode": false, - "description": "Comma-separated list of stats to return" - } - } - }, - "security": [ - { - "basic_auth": [ - - ] - }, - { - "bearer_auth": [ - - ] - } - ], - "paths": { - "/api/ent/v1/internal/health": { - "get": { - "summary": "Get information on the health of a deployment and basic statistics around resource usage", - "tags": [ - "Health API" - ], - "description": "Get information on the health of a deployment and basic statistics around resource usage", - "operationId": "getHealth", - "security": [ - { - "basic_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/enterprise-search/current/monitoring-apis.html#health-api-example" - }, - "responses": { - "401": { - "description": "unauthorized" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/health_response" - } - } - } - } - } - } - }, - "/api/ent/v1/internal/read_only_mode": { - "get": { - "summary": "Get the read-only flag's state", - "tags": [ - "Read-Only API" - ], - "description": "Get the read-only flag's state", - "operationId": "getReadOnly", - "security": [ - { - "basic_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/enterprise-search/current/read-only-api.html#getting-read-only-state" - }, - "responses": { - "401": { - "description": "unauthorized" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/read_only_state" - } - } - } - } - } - }, - "put": { - "summary": "Update the read-only flag's state", - "tags": [ - "Read-Only API" - ], - "description": "Update the read-only flag's state", - "operationId": "putReadOnly", - "security": [ - { - "basic_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/enterprise-search/current/read-only-api.html#setting-read-only-state" - }, - "parameters": [ - - ], - "responses": { - "401": { - "description": "unauthorized" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/read_only_state" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/read_only_state" - } - } - }, - "required": true - } - } - }, - "/api/ent/v1/internal/stats": { - "get": { - "summary": "Get information about the resource usage of the application, the state of different internal queues, etc.", - "tags": [ - "Stats API" - ], - "description": "Get information about the resource usage of the application, the state of different internal queues, etc.", - "operationId": "getStats", - "security": [ - { - "basic_auth": [ - - ] - } - ], - "parameters": [ - { - "name": "include", - "in": "query", - "required": false, - "$ref": "#/components/parameters/included_stats" - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/enterprise-search/current/monitoring-apis.html#stats-api-example" - }, - "responses": { - "401": { - "description": "unauthorized" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/stats_response" - } - } - } - } - } - } - }, - "/api/ent/v1/internal/storage": { - "get": { - "summary": "Get information on the application indices and the space used", - "tags": [ - "Storage API" - ], - "description": "Get information on the application indices and the space used", - "operationId": "getStorage", - "security": [ - { - "basic_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/enterprise-search/current/storage-api.html#get-storage-api" - }, - "responses": { - "401": { - "description": "unauthorized" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/storage_response" - } - } - } - } - } - } - }, - "/api/ent/v1/internal/storage/stale": { - "get": { - "summary": "Get information on the outdated application indices", - "tags": [ - "Storage API" - ], - "description": "Get information on the outdated application indices", - "operationId": "getStaleStorage", - "security": [ - { - "basic_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/enterprise-search/current/storage-api.html#get-stale-storage-api" - }, - "responses": { - "401": { - "description": "unauthorized" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/storage_response" - } - } - } - } - } - }, - "delete": { - "summary": "Cleanup outdated application indices", - "tags": [ - "Storage API" - ], - "description": "Cleanup outdated application indices", - "operationId": "deleteStaleStorage", - "security": [ - { - "basic_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/enterprise-search/current/storage-api.html#delete-stale-storage-api" - }, - "parameters": [ - { - "name": "force", - "in": "query", - "description": "The value for the \"force\" flag", - "$ref": "#/components/parameters/force", - "required": false, - "schema": { - "type": "boolean" - } - } - ], - "responses": { - "401": { - "description": "unauthorized" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/storage_cleanup_response" - } - } - } - } - } - } - }, - "/api/ent/v1/internal/version": { - "get": { - "summary": "Get version information for this server", - "tags": [ - "Version API" - ], - "description": "Get version information for this server", - "operationId": "getVersion", - "security": [ - { - "basic_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/enterprise-search/current/monitoring-apis.html#monitoring-apis-version-api" - }, - "responses": { - "401": { - "description": "unauthorized" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/version" - } - } - } - } - } - } - } - }, - "tags": [ - { - "name": "Health API", - "description": "An API for quickly getting information on the health of a deployment and basic statistics around resource usage", - "externalDocs": { - "url": "https://www.elastic.co/guide/en/enterprise-search/current/monitoring-apis.html#health-api" - } - }, - { - "name": "Version API", - "description": "An API for getting version information for this server", - "externalDocs": { - "url": "https://www.elastic.co/guide/en/enterprise-search/current/monitoring-apis.html#monitoring-apis-version-api" - } - }, - { - "name": "Stats API", - "description": "A dedicated API for getting information about the resource usage of the application, the state of different internal queues, etc.", - "externalDocs": { - "url": "https://www.elastic.co/guide/en/enterprise-search/current/monitoring-apis.html#stats-api" - } - }, - { - "name": "Read-Only API", - "description": "An API endpoint for managing the read-only mode for a deployment", - "externalDocs": { - "url": "https://www.elastic.co/guide/en/enterprise-search/current/read-only-api.html" - } - }, - { - "name": "Storage API", - "description": "An API endpoint for managing storage for a deployment", - "externalDocs": { - "url": "https://www.elastic.co/guide/en/enterprise-search/current/storage-api.html" - } - } - ] -} \ No newline at end of file diff --git a/openapi-converter/openapi_to_clients_schema/fixtures/tests/union-of-variants-external-with-properties.json b/openapi-converter/openapi_to_clients_schema/fixtures/tests/union-of-variants-external-with-properties.json index 5814ef1932..e69de29bb2 100644 --- a/openapi-converter/openapi_to_clients_schema/fixtures/tests/union-of-variants-external-with-properties.json +++ b/openapi-converter/openapi_to_clients_schema/fixtures/tests/union-of-variants-external-with-properties.json @@ -1,58 +0,0 @@ -{ - "$schema": "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/schemas/v3.1/schema.json", - "components": { - "schemas": { - "TestCase": { - "allOf": [ - { - "properties": { - "optional": { - "type": "number" - }, - "required": { - "type": "number" - } - }, - "required": [ - "required" - ] - }, - { - "oneOf": [ - { - "properties": { - "one": { - "type": "number" - } - }, - "required": [ - "one" - ] - }, - { - "properties": { - "two": { - "type": "boolean" - } - }, - "required": [ - "two" - ] - }, - { - "properties": { - "three": { - "type": "string" - } - }, - "required": [ - "three" - ] - } - ] - } - ] - } - } - } -} diff --git a/openapi-converter/openapi_to_clients_schema/fixtures/workplace-search.json b/openapi-converter/openapi_to_clients_schema/fixtures/workplace-search.json index d8787ad8e1..e69de29bb2 100644 --- a/openapi-converter/openapi_to_clients_schema/fixtures/workplace-search.json +++ b/openapi-converter/openapi_to_clients_schema/fixtures/workplace-search.json @@ -1,4862 +0,0 @@ -{ - "openapi": "3.0.2", - "info": { - "title": "Workplace Search API", - "description": "A set of product-specific APIs for Elastic Workplace Search", - "version": "v1", - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - } - }, - "servers": [ - { - "url": "{schemes}://{host}:{port}", - "variables": { - "schemes": { - "enum": [ - "http", - "https" - ], - "default": "http" - }, - "host": { - "default": "localhost", - "description": "The host running Enterprise Search" - }, - "port": { - "default": "3002" - } - } - } - ], - "components": { - "securitySchemes": { - "bearer_auth": { - "type": "apiKey", - "in": "header", - "name": "Authorization" - }, - "basic_auth": { - "type": "http", - "scheme": "basic" - } - }, - "schemas": { - "document_id": { - "type": "string", - "minLength": 1, - "maxLength": 487 - }, - "last_updated": { - "type": "string", - "format": "date-time" - }, - "errors": { - "type": "array", - "minItems": 0, - "items": { - "type": "string" - } - }, - "errors_response": { - "type": "object", - "required": [ - "errors" - ], - "additionalProperties": false, - "properties": { - "errors": { - "$ref": "#/components/schemas/errors" - } - } - }, - "meta_page": { - "type": "object", - "required": [ - "page" - ], - "properties": { - "page": { - "type": "object", - "required": [ - "current", - "total_pages", - "total_results", - "size" - ], - "properties": { - "current": { - "type": "integer" - }, - "total_pages": { - "type": "integer" - }, - "total_results": { - "type": "integer" - }, - "size": { - "type": "integer" - } - } - } - } - }, - "upload_icons_response": { - "type": "object", - "required": [ - "results" - ], - "additionalProperties": false, - "properties": { - "results": { - "type": "object", - "additionalProperties": false, - "properties": { - "main_icon": { - "type": "string" - }, - "alt_icon": { - "type": "string" - } - } - } - } - }, - "permission": { - "type": "string", - "maxLength": 256, - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-document-permissions.html", - "description": "Document level security restricts which documents a user is able to return in search results" - } - }, - "external_user_property": { - "type": "object", - "required": [ - "attribute_name", - "attribute_value" - ], - "additionalProperties": false, - "properties": { - "attribute_name": { - "type": "string", - "enum": [ - "_elasticsearch_username" - ] - }, - "attribute_value": { - "type": "string", - "maxLength": 256 - } - }, - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-external-identities-api.html", - "description": "Arbitrary properties of the user in the external system" - } - }, - "permissions": { - "type": "array", - "description": "List of permissions", - "items": { - "$ref": "#/components/schemas/permission" - } - }, - "external_user_properties": { - "type": "array", - "maxItems": 1024, - "description": "List of external user properties", - "items": { - "$ref": "#/components/schemas/external_user_property" - } - }, - "external_identity": { - "type": "object", - "required": [ - "content_source_id", - "external_user_id" - ], - "properties": { - "content_source_id": { - "type": "string" - }, - "external_user_id": { - "type": "string" - }, - "external_user_properties": { - "$ref": "#/components/schemas/external_user_properties" - }, - "permissions": { - "$ref": "#/components/schemas/permissions" - } - } - }, - "list_external_identities_response": { - "type": "object", - "required": [ - "meta", - "results" - ], - "properties": { - "meta": { - "$ref": "#/components/schemas/meta_page" - }, - "results": { - "type": "array", - "items": { - "$ref": "#/components/schemas/external_identity" - } - } - } - }, - "delete_external_identities_response": { - "type": "string", - "enum": [ - "ok" - ] - }, - "document": { - "type": "object", - "properties": { - "id": { - "$ref": "#/components/schemas/document_id" - }, - "last_updated": { - "$ref": "#/components/schemas/last_updated" - }, - "_allow_permissions": { - "$ref": "#/components/schemas/permissions" - }, - "_deny_permissions": { - "$ref": "#/components/schemas/permissions" - } - }, - "additionalProperties": true - }, - "document_bulk_create_response": { - "type": "object", - "required": [ - "results" - ], - "properties": { - "results": { - "type": "array", - "items": { - "type": "object", - "required": [ - "id", - "errors" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/document_id" - }, - "errors": { - "$ref": "#/components/schemas/errors" - } - } - } - } - } - }, - "document_bulk_delete_response": { - "type": "object", - "required": [ - "results" - ], - "properties": { - "results": { - "type": "array", - "items": { - "type": "object", - "required": [ - "id", - "success" - ], - "properties": { - "id": { - "$ref": "#/components/schemas/document_id" - }, - "success": { - "type": "boolean" - } - } - } - } - } - }, - "document_ids": { - "type": "array", - "minItems": 1, - "maxItems": 100, - "items": { - "$ref": "#/components/schemas/document_id" - } - }, - "bulk_documents": { - "type": "array", - "minItems": 1, - "maxItems": 100, - "items": { - "$ref": "#/components/schemas/document" - } - }, - "delete_documents_by_query_response": { - "type": "object", - "required": [ - "total", - "deleted", - "failures" - ], - "properties": { - "total": { - "type": "integer" - }, - "deleted": { - "type": "integer" - }, - "failures": { - "type": "array", - "items": { - "type": "object", - "additionalProperties": true - } - } - } - }, - "record_deleted_response": { - "type": "object", - "required": [ - "deleted" - ], - "properties": { - "deleted": { - "type": "boolean", - "enum": [ - true - ] - } - } - }, - "single_document_response": { - "type": "object", - "required": [ - "id", - "source", - "content_source_id", - "last_updated" - ], - "additionalProperties": true, - "properties": { - "id": { - "type": "string" - }, - "source": { - "type": "string" - }, - "content_source_id": { - "type": "string" - }, - "last_updated": { - "type": "string", - "format": "date-time" - }, - "_allow_permissions": { - "$ref": "#/components/schemas/permissions" - }, - "_deny_permissions": { - "$ref": "#/components/schemas/permissions" - } - } - }, - "document_list_response": { - "type": "object", - "required": [ - "meta", - "results" - ], - "additionalProperties": false, - "properties": { - "meta": { - "type": "object", - "required": [ - "page", - "cursor", - "warnings" - ], - "additionalProperties": false, - "properties": { - "page": { - "type": "object", - "required": [ - "current", - "total_pages", - "total_results", - "size" - ], - "properties": { - "current": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "integer" - } - ] - }, - "total_pages": { - "type": "integer" - }, - "total_results": { - "type": "integer" - }, - "size": { - "type": "integer" - } - } - }, - "cursor": { - "type": "object", - "required": [ - "current", - "next" - ], - "properties": { - "current": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - } - ] - }, - "next": { - "oneOf": [ - { - "type": "null" - }, - { - "type": "string" - } - ] - } - } - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "results": { - "type": "array", - "items": { - "$ref": "#/components/schemas/single_document_response" - } - } - } - }, - "list_content_sources_response": { - "type": "object", - "required": [ - "meta", - "results" - ], - "properties": { - "meta": { - "$ref": "#/components/schemas/meta_page" - }, - "results": { - "type": "array", - "items": { - "$ref": "#/components/schemas/content_source" - } - } - } - }, - "content_source_partial_create_response": { - "description": "Returned when a create request successfully created a content source, but failed to fully configure it as requested", - "type": "object", - "required": [ - "created", - "errors" - ], - "additionalProperties": false, - "properties": { - "created": { - "$ref": "#/components/schemas/content_source", - "description": "The state of the newly created content source" - }, - "errors": { - "$ref": "#/components/schemas/errors", - "description": "Errors that occurred while attempting to configure and finalize the content source. Correct these errors, and follow up with an \"update\" request." - } - } - }, - "content_source_partial_update_response": { - "description": "Returned when an update request partially updated a content source, but failed to fully configure it as requested", - "type": "object", - "required": [ - "updated", - "errors" - ], - "additionalProperties": false, - "properties": { - "updated": { - "$ref": "#/components/schemas/content_source", - "description": "The state of the updated content source" - }, - "errors": { - "$ref": "#/components/schemas/errors", - "description": "Errors that occurred while attempting to configure and finalize the content source. Correct these errors, and follow up with another \"update\" request." - } - } - }, - "whoami_response": { - "type": "object", - "required": [ - "username", - "email" - ], - "additionalProperties": false, - "properties": { - "username": { - "type": "string" - }, - "email": { - "type": "string" - }, - "access_token": { - "type": "string" - } - } - }, - "sync_job_definition": { - "type": "object", - "required": [ - "id", - "job_type", - "status", - "created_at", - "last_updated_at" - ], - "additionalProperties": false, - "properties": { - "id": { - "type": "string" - }, - "job_type": { - "type": "string", - "enum": [ - "full", - "incremental", - "delete", - "permissions" - ] - }, - "status": { - "type": "string", - "enum": [ - "enqueued", - "running", - "suspended", - "failed", - "complete" - ] - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "last_updated_at": { - "type": "string", - "format": "date-time" - } - } - }, - "started_sync_jobs": { - "type": "object", - "required": [ - "started" - ], - "additionalProperties": false, - "properties": { - "started": { - "type": "array", - "items": { - "$ref": "#/components/schemas/sync_job_definition" - } - } - } - }, - "interrupted_sync_jobs": { - "type": "object", - "required": [ - "interrupted" - ], - "additionalProperties": false, - "properties": { - "interrupted": { - "type": "array", - "items": { - "$ref": "#/components/schemas/sync_job_definition" - } - } - } - }, - "sync_jobs_command_response": { - "type": "object", - "required": [ - "results" - ], - "additionalProperties": false, - "properties": { - "results": { - "oneOf": [ - { - "$ref": "#/components/schemas/started_sync_jobs" - }, - { - "$ref": "#/components/schemas/interrupted_sync_jobs" - } - ] - } - } - }, - "automatic_query_refinement_details_response": { - "type": "object", - "required": [ - "overrides", - "defaults", - "results" - ], - "additionalProperties": false, - "properties": { - "overrides": { - "type": "array", - "items": { - "$ref": "#/components/schemas/content_source_automatic_query_refinement" - } - }, - "defaults": { - "type": "array", - "items": { - "$ref": "#/components/schemas/content_source_enabled_automatic_query_refinement" - } - }, - "results": { - "type": "array", - "items": { - "$ref": "#/components/schemas/content_source_enabled_automatic_query_refinement" - } - } - } - }, - "content_source_enabled_automatic_query_refinement": { - "type": "object", - "required": [ - "field", - "query_expansion_phrases", - "is_person" - ], - "properties": { - "field": { - "type": "string" - }, - "query_expansion_phrases": { - "type": "array", - "items": { - "type": "string" - } - }, - "is_person": { - "type": "boolean" - } - }, - "additionalProperties": false - }, - "triggers_blocklist_definition": { - "type": "array", - "items": { - "type": "string" - } - }, - "triggers_blocklist_wrapper_definition": { - "type": "object", - "required": [ - "blocklist" - ], - "additionalProperties": false, - "properties": { - "blocklist": { - "type": "array", - "items": { - "type": "string" - } - } - } - }, - "filter_value": { - "description": "A value to filter on", - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "array_or_singular_filter_value": { - "oneOf": [ - { - "$ref": "#/components/schemas/filter_value" - }, - { - "type": "array", - "maxItems": 1024, - "items": { - "$ref": "#/components/schemas/filter_value" - } - } - ] - }, - "range_filter": { - "type": "object", - "minProperties": 1, - "additionalProperties": false, - "properties": { - "from": { - "description": "The start of the range, inclusive", - "$ref": "#/components/schemas/filter_value" - }, - "to": { - "description": "The end of the range, exclusive", - "$ref": "#/components/schemas/filter_value" - } - } - }, - "geo_range_filter": { - "type": "object", - "description": "A range filter with a geographic center", - "minProperties": 3, - "additionalProperties": false, - "required": [ - "unit", - "center" - ], - "properties": { - "unit": { - "description": "The base unit of measurement [mm, cm, m (meters), km, in, ft, yd, or mi (miles)]", - "$ref": "#/components/schemas/geo_unit_enum" - }, - "center": { - "description": "The mode of the distribution as a \"lat, lon\" string, \"POINT(lon lat)\" WKT POINT string, Geohash string, or [lon, lat] array", - "$ref": "#/components/schemas/geo_point" - }, - "from": { - "description": "Inclusive lower bound of the range. Is required if to is not provided", - "$ref": "#/components/schemas/filter_value" - }, - "to": { - "description": "Exclusive upper bound of the range. Is required if from is not provided", - "$ref": "#/components/schemas/filter_value" - } - } - }, - "geo_distance_filter": { - "type": "object", - "additionalProperties": false, - "required": [ - "unit", - "center", - "distance" - ], - "properties": { - "unit": { - "description": "The base unit of measurement [mm, cm, m (meters), km, in, ft, yd, or mi (miles)]", - "$ref": "#/components/schemas/geo_unit_enum" - }, - "center": { - "description": "The mode of the distribution as a \"lat, lon\" string, \"POINT(lon lat)\" WKT POINT string, Geohash string, or [lon, lat] array", - "$ref": "#/components/schemas/geo_point" - }, - "distance": { - "description": "A number representing the distance unit", - "type": "number", - "minimum": 0, - "maximum": 1.7976931348623157e+308 - } - } - }, - "geo_point": { - "type": "object", - "anyOf": [ - { - "type": "string", - "pattern": "(\\A\\s*(?[-+]?\\d*\\.?\\d+)\\s*,\\s*(?[-+]?\\d*\\.?\\d+)\\s*\\z)" - }, - { - "type": "string", - "pattern": "(?i-mx:\\A\\s*POINT\\s*\\(\\s*(?[-+]?\\d*\\.?\\d+)\\s+(?[-+]?\\d*\\.?\\d+)\\s*\\)\\s*\\z)" - }, - { - "type": "string", - "pattern": "(\\A[0-9b-hjkmnp-z]+\\z)" - }, - { - "type": "array", - "minItems": 2, - "maxItems": 2, - "additionalItems": false, - "items": [ - { - "type": "number", - "minimum": -180, - "maximum": 180 - }, - { - "type": "number", - "minimum": -90, - "maximum": 90 - } - ] - } - ] - }, - "filter": { - "type": "object", - "minProperties": 0, - "maxProperties": 1, - "not": { - "minProperties": 1, - "additionalProperties": false, - "properties": { - "any": { -}, - "all": { -}, - "none": { -} - } - }, - "additionalProperties": { - "oneOf": [ - { - "$ref": "#/components/schemas/array_or_singular_filter_value" - }, - { - "$ref": "#/components/schemas/range_filter" - }, - { - "$ref": "#/components/schemas/geo_range_filter" - }, - { - "$ref": "#/components/schemas/geo_distance_filter" - } - ] - } - }, - "filter_clauses": { - "type": "object", - "minProperties": 1, - "additionalProperties": false, - "properties": { - "any": { - "$ref": "#/components/schemas/array_or_singular_filter_clauses_or_filter" - }, - "all": { - "$ref": "#/components/schemas/array_or_singular_filter_clauses_or_filter" - }, - "none": { - "$ref": "#/components/schemas/array_or_singular_filter_clauses_or_filter" - } - } - }, - "array_or_singular_filter_clauses_or_filter": { - "oneOf": [ - { - "$ref": "#/components/schemas/filter_clauses_or_filter" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/filter_clauses_or_filter" - } - } - ] - }, - "filter_clauses_or_filter": { - "oneOf": [ - { - "$ref": "#/components/schemas/filter_clauses" - }, - { - "$ref": "#/components/schemas/filter" - } - ] - }, - "geo_unit_enum": { - "enum": [ - "m", - "mi", - "in", - "ft", - "yd", - "km", - "cm", - "mm" - ] - }, - "sort": { - "type": "object", - "description": "Field and direction to sort on", - "minProperties": 1, - "maxProperties": 1, - "additionalProperties": { - "enum": [ - "asc", - "desc" - ] - } - }, - "facet_sort": { - "type": "object", - "description": "Facet field to sort on and sort by count and/or value", - "minProperties": 1, - "maxProperties": 1, - "properties": { - "count": { - "enum": [ - "asc", - "desc" - ] - }, - "value": { - "enum": [ - "asc", - "desc" - ] - } - }, - "additionalProperties": false - }, - "facet_value": { - "type": "object", - "description": "Facet by a field value", - "properties": { - "type": { - "enum": [ - "value" - ] - }, - "name": { - "type": "string" - }, - "size": { - "type": "integer", - "minimum": 1, - "maximum": 250, - "default": 10 - }, - "sort": { - "$ref": "#/components/schemas/facet_sort" - } - }, - "additionalProperties": false, - "required": [ - "type" - ] - }, - "facet_range_item": { - "type": "object", - "description": "The range for a facet's bucket", - "properties": { - "from": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" - } - ] - }, - "to": { - "oneOf": [ - { - "type": "number" - }, - { - "type": "string" - } - ] - }, - "name": { - "type": "string" - } - }, - "anyOf": [ - { - "required": [ - "from" - ] - }, - { - "required": [ - "to" - ] - } - ], - "additionalProperties": false - }, - "facet_range": { - "type": "object", - "description": "Faceting into buckets by a range of values", - "properties": { - "type": { - "enum": [ - "range" - ] - }, - "name": { - "type": "string" - }, - "ranges": { - "type": "array", - "items": { - "$ref": "#/components/schemas/facet_range_item" - }, - "minItems": 1 - }, - "center": { - "$ref": "#/components/schemas/geo_point" - }, - "unit": { - "$ref": "#/components/schemas/geo_unit_enum" - } - }, - "additionalProperties": false, - "required": [ - "type", - "ranges" - ] - }, - "facet_item": { - "anyOf": [ - { - "$ref": "#/components/schemas/facet_range" - }, - { - "$ref": "#/components/schemas/facet_value" - } - ] - }, - "boost_value_itemtype": { - "oneOf": [ - { - "$ref": "#/components/schemas/filter_value" - }, - { - "type": "array", - "items": { - "$ref": "#/components/schemas/filter_value" - } - } - ] - }, - "boost_is_value_type": { - "properties": { - "type": { - "enum": [ - "value" - ] - } - } - }, - "boost_is_functional_type": { - "properties": { - "type": { - "enum": [ - "functional" - ] - } - } - }, - "boost_is_proximity_type": { - "properties": { - "type": { - "enum": [ - "proximity" - ] - } - } - }, - "boost_value_requirements": { - "anyOf": [ - { - "not": { - "$ref": "#/components/schemas/boost_is_value_type" - } - }, - { - "required": [ - "value" - ], - "not": { - "anyOf": [ - { - "required": [ - "function" - ] - }, - { - "required": [ - "center" - ] - } - ] - } - } - ] - }, - "boost_functional_requirements": { - "anyOf": [ - { - "not": { - "$ref": "#/components/schemas/boost_is_functional_type" - } - }, - { - "required": [ - "function" - ], - "properties": { - "function": { - "enum": [ - "linear", - "exponential", - "logarithmic" - ] - } - }, - "not": { - "anyOf": [ - { - "required": [ - "value" - ] - }, - { - "required": [ - "center" - ] - } - ] - } - } - ] - }, - "boost_proximity_requirements": { - "anyOf": [ - { - "not": { - "$ref": "#/components/schemas/boost_is_proximity_type" - } - }, - { - "required": [ - "center", - "function" - ], - "properties": { - "center": { - "anyOf": [ - { - "$ref": "#/components/schemas/filter_value" - }, - { - "$ref": "#/components/schemas/geo_point" - } - ] - }, - "function": { - "enum": [ - "linear", - "exponential", - "gaussian" - ] - } - } - } - ] - }, - "boost_item": { - "type": "object", - "description": "Field and type of boost with tuning parameters", - "properties": { - "type": { - "enum": [ - "value", - "functional", - "proximity" - ] - }, - "value": { - "$ref": "#/components/schemas/boost_value_itemtype" - }, - "function": { - "enum": [ - "linear", - "exponential", - "logarithmic", - "gaussian" - ] - }, - "operation": { - "type": "string", - "enum": [ - "add", - "multiply" - ], - "default": "add" - }, - "factor": { - "type": "number", - "default": 1.0, - "minimum": 0.0, - "maximum": 10.0 - }, - "center": { - "anyOf": [ - { - "$ref": "#/components/schemas/filter_value" - }, - { - "$ref": "#/components/schemas/geo_point" - } - ] - } - }, - "allOf": [ - { - "$ref": "#/components/schemas/boost_proximity_requirements" - }, - { - "$ref": "#/components/schemas/boost_functional_requirements" - }, - { - "$ref": "#/components/schemas/boost_value_requirements" - } - ], - "required": [ - "type" - ], - "additionalProperties": false - }, - "search_api_query": { - "type": "object", - "additionalProperties": false, - "properties": { - "query": { - "type": "string", - "maxLength": 128, - "default": "", - "description": "A string or number used to find related documents" - }, - "automatic_query_refinement": { - "type": "boolean", - "default": true, - "description": "Set to false to not automatically refine the query by keywords" - }, - "page": { - "type": "object", - "description": "Paging controls for the result set", - "additionalProperties": false, - "default": { -}, - "properties": { - "size": { - "type": "integer", - "minimum": 1, - "maximum": 100, - "default": 10 - }, - "current": { - "type": "integer", - "minimum": 1, - "maximum": 100, - "default": 1 - } - } - }, - "search_fields": { - "type": "object", - "description": "Restrict the fulltext search to only specific fields", - "minProperties": 1, - "additionalProperties": { - "type": "object", - "additionalProperties": false, - "properties": { - "weight": { - "type": "integer", - "minimum": 0, - "maximum": 1000 - } - } - } - }, - "result_fields": { - "type": "object", - "description": "Restrict the result fields for each item to the specified fields", - "minProperties": 1, - "additionalProperties": { - "type": "object", - "minProperties": 1, - "additionalProperties": false, - "properties": { - "raw": { - "type": "object", - "additionalProperties": false, - "properties": { - "size": { - "type": "integer", - "minimum": 20, - "maximum": 1000 - } - } - }, - "snippet": { - "type": "object", - "additionalProperties": false, - "properties": { - "size": { - "type": "integer", - "default": 100, - "minimum": 20, - "maximum": 1000 - }, - "fallback": { - "type": "boolean", - "default": false - } - } - } - } - } - }, - "filters": { - "$ref": "#/components/schemas/filter_clauses_or_filter" - }, - "sort": { - "default": { - "_score": "desc" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/sort" - }, - { - "type": "array", - "maxItems": 10, - "items": { - "$ref": "#/components/schemas/sort" - } - } - ] - }, - "facets": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/components/schemas/facet_item" - } - }, - { - "$ref": "#/components/schemas/facet_item" - } - ] - } - }, - "boosts": { - "type": "object", - "additionalProperties": { - "oneOf": [ - { - "type": "array", - "items": { - "$ref": "#/components/schemas/boost_item" - } - }, - { - "$ref": "#/components/schemas/boost_item" - } - ] - } - }, - "source_type": { - "enum": [ - "standard", - "remote", - "all" - ], - "description": "Optional parameter to search standard, remote only, or all available sources", - "default": "standard" - }, - "timeout": { - "type": "integer", - "description": "Optional timeout in ms for searching remote sources", - "minimum": 1 - }, - "content_sources": { - "type": "array", - "description": "Optional list of content source ids to only return results from", - "minItems": 1, - "items": { - "type": "string" - } - } - } - }, - "documents_api_query": { - "type": "object", - "additionalProperties": false, - "properties": { - "page": { - "type": "object", - "description": "Paging controls for the result set", - "additionalProperties": false, - "default": { -}, - "properties": { - "size": { - "type": "integer", - "minimum": 1, - "maximum": 100, - "default": 10 - }, - "current": { - "type": "integer", - "minimum": 1, - "maximum": 100, - "default": 1 - } - } - }, - "filters": { - "$ref": "#/components/schemas/filter_clauses_or_filter" - }, - "sort": { - "default": { - "_score": "desc" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/sort" - }, - { - "type": "array", - "maxItems": 10, - "items": { - "$ref": "#/components/schemas/sort" - } - } - ] - }, - "cursor": { - "type": "string", - "pattern": "^[a-zA-Z0-9+/]+=*$" - } - } - }, - "query_refinement_item": { - "type": "object", - "description": "Specifics regarding how this part of the query was refined", - "properties": { - "term": { - "type": "string", - "description": "The term(s) used for the trigger" - }, - "position": { - "type": "array", - "maxItems": 2, - "minItems": 2, - "items": { - "type": "number" - }, - "description": "The start and end position the term(s) exist in the original query" - }, - "trigger_type": { - "type": "string", - "description": "The type of trigger created" - }, - "trigger_filter_type": { - "type": "string", - "description": "The type of filter created from this trigger" - }, - "filter": { - "$ref": "#/components/schemas/filter" - } - } - }, - "search_api_result_item": { - "type": "object", - "description": "A single search result item", - "properties": { - "_meta": { - "type": "object", - "description": "Metadata about this specific result item", - "properties": { - "source": { - "type": "string" - }, - "last_updated": { - "type": "string" - }, - "content_source_id": { - "type": "string" - }, - "id": { - "type": "string" - }, - "score": { - "type": "number" - } - } - } - }, - "additionalProperties": { - "type": "object", - "properties": { - "raw": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "snippet": { - "type": "string", - "nullable": true - } - } - } - }, - "search_api_query_refinement": { - "type": "object", - "description": "Metadata regarding automatic refinements made to the query", - "properties": { - "submitted_query": { - "type": "string" - }, - "decorated_query_html": { - "type": "string" - }, - "refinements": { - "type": "array", - "items": { - "$ref": "#/components/schemas/query_refinement_item" - } - } - }, - "required": [ - "submitted_query", - "decorated_query_html", - "refinements" - ] - }, - "search_api_meta_content_source": { - "description": "a content source used in the search query", - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "service_type": { - "type": "string" - } - } - }, - "search_api_meta_content_sources": { - "description": "content sources used in the search query", - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/search_api_meta_content_source" - } - }, - "search_facet_response_item": { - "description": "A single facet that was returned from the query", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "value", - "range" - ] - }, - "data": { - "type": "array", - "description": "array of facets and counts for this field", - "items": { - "type": "object", - "properties": { - "value": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "count": { - "type": "integer" - }, - "key": { - "type": "string" - }, - "from": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - }, - "to": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "number" - } - ] - } - }, - "required": [ - "count" - ] - } - } - } - }, - "search_facets_response": { - "description": "facets returned from the query", - "oneOf": [ - { - "$ref": "#/components/schemas/search_facet_response_item" - }, - { - "type": "array", - "maxItems": 1024, - "items": { - "$ref": "#/components/schemas/search_facet_response_item" - } - } - ] - }, - "search_api_endpoint_response": { - "type": "object", - "properties": { - "meta": { - "type": "object", - "properties": { - "page": { - "type": "object", - "required": [ - "current", - "total_pages", - "total_results", - "size" - ], - "properties": { - "current": { - "type": "integer" - }, - "total_pages": { - "type": "integer" - }, - "total_results": { - "type": "integer" - }, - "size": { - "type": "integer" - } - } - }, - "request_id": { - "type": "string", - "description": "Internal request ID for this query instance" - }, - "warnings": { - "type": "array", - "items": { - "type": "string" - }, - "description": "Any warnings that the query generated" - }, - "query_refinements": { - "$ref": "#/components/schemas/search_api_query_refinement" - }, - "content_sources": { - "$ref": "#/components/schemas/search_api_meta_content_sources" - }, - "timeout": { - "type": "integer", - "description": "Remote source query timeout value used" - } - }, - "required": [ - "page", - "request_id" - ] - }, - "results": { - "type": "array", - "items": { - "$ref": "#/components/schemas/search_api_result_item" - } - }, - "facets": { - "$ref": "#/components/schemas/search_facets_response" - } - }, - "required": [ - "meta", - "results" - ] - }, - "event_is_click_type": { - "properties": { - "type": { - "enum": [ - "click" - ] - } - } - }, - "event_is_feedback_type": { - "properties": { - "type": { - "enum": [ - "feedback" - ] - } - } - }, - "event_click_requirements": { - "anyOf": [ - { - "not": { - "$ref": "#/components/schemas/event_is_click_type" - } - }, - { - "required": [ - "event" - ], - "not": { - "anyOf": [ - { - "required": [ - "score" - ] - } - ] - } - } - ] - }, - "event_feedback_requirements": { - "anyOf": [ - { - "not": { - "$ref": "#/components/schemas/event_is_feedback_type" - } - }, - { - "required": [ - "score" - ], - "not": { - "anyOf": [ - { - "required": [ - "event" - ] - } - ] - } - } - ] - }, - "analytics_event": { - "description": "Workplace Search analytics event", - "type": "object", - "additionalProperties": false, - "required": [ - "type", - "query_id", - "page", - "content_source_id", - "document_id", - "rank" - ], - "allOf": [ - { - "$ref": "#/components/schemas/event_click_requirements" - }, - { - "$ref": "#/components/schemas/event_feedback_requirements" - } - ], - "properties": { - "type": { - "type": "string", - "enum": [ - "click", - "feedback" - ] - }, - "query_id": { - "type": "string", - "minLength": 1, - "maxLength": 128, - "description": "query identifier for the event" - }, - "page": { - "type": "integer", - "minimum": 1, - "description": "page number of the document in the query result set" - }, - "content_source_id": { - "type": "string", - "minLength": 1, - "maxLength": 128, - "description": "content source identifier for the event document" - }, - "document_id": { - "type": "string", - "minLength": 1, - "maxLength": 128, - "description": "document identifier for the event" - }, - "rank": { - "type": "integer", - "minimum": 0, - "description": "rank of the document in the overall result set" - }, - "event": { - "type": "string", - "minLength": 1, - "maxLength": 128, - "default": "api", - "description": "the target identifier for a click event" - }, - "score": { - "type": "integer", - "enum": [ - -1, - 1 - ], - "description": "the feedback score, constrained to the values -1 or 1" - } - } - }, - "search_group": { - "type": "object", - "required": [ - "id", - "name" - ], - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - } - } - }, - "content_source_detail": { - "type": "object", - "additionalProperties": true - }, - "content_source_schema": { - "type": "object", - "additionalProperties": { - "type": "string", - "enum": [ - "text", - "geolocation", - "number", - "date" - ] - } - }, - "content_source_display_detail": { - "type": "object", - "required": [ - "label", - "field_name" - ], - "properties": { - "label": { - "type": "string" - }, - "field_name": { - "type": "string" - } - } - }, - "content_source_display": { - "type": "object", - "required": [ - "title_field", - "url_field" - ], - "additionalProperties": false, - "properties": { - "title_field": { - "type": "string" - }, - "url_field": { - "type": "string" - }, - "color": { - "type": "string", - "pattern": "^#[a-fA-F0-9]{6}$" - }, - "description_field": { - "type": "string", - "nullable": true - }, - "subtitle_field": { - "type": "string", - "nullable": true - }, - "type_field": { - "type": "string", - "nullable": true - }, - "media_type_field": { - "type": "string", - "nullable": true - }, - "created_by_field": { - "type": "string", - "nullable": true - }, - "updated_by_field": { - "type": "string", - "nullable": true - }, - "detail_fields": { - "type": "array", - "items": { - "$ref": "#/components/schemas/content_source_display_detail" - } - } - } - }, - "content_source_indexing_response": { - "type": "object", - "nullable": true, - "description": "Rules for indexing the content for this Content Source", - "required": [ - "default_action" - ], - "additionalProperties": false, - "properties": { - "enabled": { - "type": "boolean" - }, - "features": { - "$ref": "#/components/schemas/content_source_indexing_features" - }, - "default_action": { - "type": "string", - "enum": [ - "include", - "exclude" - ] - }, - "rules": { - "type": "array", - "minItems": 0, - "items": { - "$ref": "#/components/schemas/content_source_indexing_rule" - } - }, - "schedule": { - "$ref": "#/components/schemas/content_source_schedule_response" - } - } - }, - "content_source_indexing_features": { - "type": "object", - "required": [ - "thumbnails", - "content_extraction" - ], - "additionalProperties": false, - "properties": { - "thumbnails": { - "type": "object", - "required": [ - "enabled" - ], - "additionalProperties": false, - "properties": { - "enabled": { - "type": "boolean" - } - } - }, - "content_extraction": { - "type": "object", - "required": [ - "enabled" - ], - "additionalProperties": false, - "properties": { - "enabled": { - "type": "boolean" - } - } - } - } - }, - "content_source_indexing_rule": { - "type": "object", - "description": "An indexing rule to index or omit the content for this Content Source", - "properties": { - "exclude": { - "type": "string" - }, - "include": { - "type": "string" - }, - "filter_type": { - "type": "string", - "enum": [ - "object_type", - "path_template", - "file_extension" - ] - }, - "fields": { - "nullable": true, - "type": "array", - "items": { - "$ref": "#/components/schemas/content_source_indexing_rules_field" - } - } - }, - "minProperties": 1, - "maxProperties": 3, - "additionalProperties": false - }, - "content_source_indexing_rules_field": { - "type": "object", - "description": "A field to define remote data capture", - "required": [ - "remote", - "target" - ], - "properties": { - "remote": { - "type": "string" - }, - "target": { - "type": "string" - } - }, - "additionalProperties": false - }, - "content_source_schedule_response": { - "type": "object", - "nullable": true, - "description": "Schedule defining when and how often the content source should be synchronized", - "additionalProperties": false, - "properties": { - "full": { - "type": "string", - "description": "How often a full data synchronization should be performed, as an ISO-8601 duration" - }, - "incremental": { - "type": "string", - "description": "How often to synchronize new changes, as an ISO-8601 duration" - }, - "delete": { - "type": "string", - "description": "How often to purge deleted documents, as an ISO-8601 duration" - }, - "permissions": { - "type": "string", - "description": "How often to update user permissions, as an ISO-8601 duration" - }, - "blocked_windows": { - "type": "array", - "minItems": 0, - "items": { - "$ref": "#/components/schemas/content_source_job_type_window" - } - }, - "estimates": { - "type": "object", - "description": "Estimates of when the next sync of each type will be run and average execution time", - "additionalProperties": false, - "properties": { - "full": { - "$ref": "#/components/schemas/content_source_schedule_estimates" - }, - "incremental": { - "$ref": "#/components/schemas/content_source_schedule_estimates" - }, - "delete": { - "$ref": "#/components/schemas/content_source_schedule_estimates" - }, - "permissions": { - "$ref": "#/components/schemas/content_source_schedule_estimates" - } - } - } - } - }, - "content_source_schedule_estimates": { - "type": "object", - "additionalProperties": false, - "properties": { - "last_run": { - "type": "string", - "description": "The last run time" - }, - "duration": { - "type": "string", - "description": "The average execution time of the last 5 completed jobs, in ISO-8601 format" - }, - "next_start": { - "type": "string", - "description": "The estimated next execution time" - } - } - }, - "content_source_job_type_window": { - "type": "object", - "description": "A time window that applies to a specific type of job", - "required": [ - "job_type", - "day" - ], - "properties": { - "job_type": { - "type": "string", - "enum": [ - "full", - "incremental", - "delete", - "permissions", - "all" - ] - }, - "day": { - "type": "string", - "enum": [ - "all", - "sunday", - "monday", - "tuesday", - "wednesday", - "thursday", - "friday", - "saturday" - ] - }, - "start": { - "type": "string", - "description": "The start of the time window, in the format of HH:mm:ssZ" - }, - "end": { - "type": "string", - "description": "The end of the time window, in the format of HH:mm:ssZ" - } - }, - "additionalProperties": false - }, - "content_source_facets": { - "type": "object", - "nullable": true, - "description": "Facet customizations", - "required": [ - "overrides" - ], - "additionalProperties": false, - "properties": { - "overrides": { - "type": "array", - "minItems": 0, - "items": { - "$ref": "#/components/schemas/content_source_facet" - } - } - } - }, - "content_source_facet": { - "type": "object", - "required": [ - "field", - "enabled" - ], - "properties": { - "field": { - "type": "string" - }, - "enabled": { - "type": "boolean" - }, - "display_name": { - "type": "string", - "nullable": true - }, - "transform": { - "type": "string", - "enum": [ - "capitalize", - "titleize", - "mime_type", - null - ], - "nullable": true - } - } - }, - "content_source_automatic_query_refinements": { - "type": "object", - "nullable": true, - "description": "Automatic query refinement customizations", - "required": [ - "overrides" - ], - "additionalProperties": false, - "properties": { - "overrides": { - "type": "array", - "minItems": 0, - "items": { - "$ref": "#/components/schemas/content_source_automatic_query_refinement" - } - } - } - }, - "content_source_automatic_query_refinement": { - "type": "object", - "required": [ - "field", - "enabled", - "query_expansion_phrases" - ], - "properties": { - "field": { - "type": "string" - }, - "enabled": { - "type": "boolean" - }, - "query_expansion_phrases": { - "type": "array", - "items": { - "type": "string" - } - }, - "is_person": { - "type": "boolean", - "default": false - } - } - }, - "content_source": { - "description": "Workplace Search Content Source", - "type": "object", - "required": [ - "id", - "service_type", - "created_at", - "last_updated_at", - "is_remote", - "details", - "groups", - "name", - "context", - "is_searchable" - ], - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "description": "The Content Source Identifier." - }, - "service_type": { - "type": "string", - "description": "The Content Source's Service Type. For example, for Google Drive the Service Type is \"google_drive\"." - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "The date/time at which this Content Source was originally created." - }, - "last_updated_at": { - "type": "string", - "format": "date-time", - "description": "The date/time at which this Content Source was last updated." - }, - "is_remote": { - "type": "boolean", - "description": "Whether or not this Content Source is a \"remote\" content source. See https://www.elastic.co/guide/en/workplace-search/current/workplace-search-content-sources.html#remote" - }, - "details": { - "type": "array", - "minItems": 0, - "items": { - "$ref": "#/components/schemas/content_source_detail" - }, - "description": "A list of key/value metadata for the Content Source and the account which authenticated/connected it." - }, - "groups": { - "type": "array", - "minItems": 0, - "items": { - "$ref": "#/components/schemas/search_group" - }, - "description": "A list of Workplace Search Group names and IDs which have access to this Content Source." - }, - "name": { - "type": "string", - "description": "The human readable display name of this Content Source." - }, - "schema": { - "$ref": "#/components/schemas/content_source_schema", - "description": "The schema that each document in this Content Source must adhere to." - }, - "display": { - "$ref": "#/components/schemas/content_source_display", - "description": "The display details which governs which fields are displayed, and in what order, in the search results." - }, - "context": { - "type": "string", - "enum": [ - "organization", - "private" - ], - "description": "Can be either \"organization\" or \"private.\" This specifies whether this Content Source is available to groups of users, or a single user." - }, - "is_searchable": { - "type": "boolean", - "description": "Whether or not this Content Source can currently be searched over on the search page." - }, - "indexing": { - "$ref": "#/components/schemas/content_source_indexing_response" - }, - "facets": { - "$ref": "#/components/schemas/content_source_facets" - }, - "automatic_query_refinement": { - "$ref": "#/components/schemas/content_source_automatic_query_refinements" - }, - "document_count": { - "type": "integer", - "description": "How many documents are currently indexed in this Content Source. Note, this field is not applicable to Remote Content Sources." - }, - "last_indexed_at": { - "type": "string", - "format": "date-time", - "nullable": true, - "description": "The date/time when documents were last indexed into this Content Source. This may be \"null\" if documents have not yet been indexed. Note, this field is not applicable to Remote Content Sources." - } - } - }, - "content_source_indexing": { - "type": "object", - "nullable": true, - "description": "Rules for indexing the content for this Content Source", - "required": [ - "default_action" - ], - "additionalProperties": false, - "properties": { - "enabled": { - "type": "boolean" - }, - "features": { - "$ref": "#/components/schemas/content_source_indexing_features" - }, - "default_action": { - "type": "string", - "enum": [ - "include", - "exclude" - ] - }, - "rules": { - "type": "array", - "minItems": 0, - "items": { - "$ref": "#/components/schemas/content_source_indexing_rule" - } - }, - "schedule": { - "$ref": "#/components/schemas/content_source_schedule" - } - } - }, - "content_source_schedule": { - "type": "object", - "nullable": true, - "description": "Schedule defining when and how often the content source should be synchronized", - "additionalProperties": false, - "properties": { - "full": { - "type": "string", - "description": "How often a full data synchronization should be performed, as an ISO-8601 duration" - }, - "incremental": { - "type": "string", - "description": "How often to synchronize new changes, as an ISO-8601 duration" - }, - "delete": { - "type": "string", - "description": "How often to purge deleted documents, as an ISO-8601 duration" - }, - "permissions": { - "type": "string", - "description": "How often to update user permissions, as an ISO-8601 duration" - }, - "blocked_windows": { - "type": "array", - "minItems": 0, - "items": { - "$ref": "#/components/schemas/content_source_job_type_window" - } - } - } - }, - "content_source_create_definition": { - "description": "Definition to create a Workplace Search Content Source", - "type": "object", - "required": [ - "name" - ], - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "pattern": "^[\\w\\s.()'\\-\\/]*$", - "maxLength": 64, - "description": "The human readable display name for this Content Source." - }, - "schema": { - "$ref": "#/components/schemas/content_source_schema", - "description": "The schema that each document in this Content Source will adhere to." - }, - "display": { - "$ref": "#/components/schemas/content_source_display", - "description": "The display details which governs which fields will be displayed, and in what order, in the search results." - }, - "is_searchable": { - "type": "boolean", - "description": "Whether or not this Content Source will be searchable on the search page." - }, - "indexing": { - "$ref": "#/components/schemas/content_source_indexing" - }, - "facets": { - "$ref": "#/components/schemas/content_source_facets" - }, - "automatic_query_refinement": { - "$ref": "#/components/schemas/content_source_automatic_query_refinements" - } - } - }, - "content_source_update_definition": { - "description": "Definition to update a Workplace Search Content Source", - "type": "object", - "required": [ - "name", - "is_searchable" - ], - "additionalProperties": false, - "properties": { - "name": { - "type": "string", - "pattern": "^[\\w\\s.()'\\-\\/]*$", - "maxLength": 64, - "description": "The human readable display name for this Content Source." - }, - "schema": { - "$ref": "#/components/schemas/content_source_schema", - "description": "The schema that each document in this Content Source will adhere to." - }, - "display": { - "$ref": "#/components/schemas/content_source_display", - "description": "The display details which governs which fields will be displayed, and in what order, in the search results." - }, - "is_searchable": { - "type": "boolean", - "description": "Whether or not this Content Source will be searchable on the search page." - }, - "indexing": { - "$ref": "#/components/schemas/content_source_indexing" - }, - "facets": { - "$ref": "#/components/schemas/content_source_facets" - }, - "automatic_query_refinement": { - "$ref": "#/components/schemas/content_source_automatic_query_refinements" - } - } - }, - "abstract_sync_command": { - "required": [ - "command" - ] - }, - "start_sync_command": { - "allOf": [ - { - "$ref": "#/components/schemas/abstract_sync_command" - }, - { - "type": "object", - "description": "Command to start a synchronisation job for Content Source", - "properties": { - "force_interrupt": { - "type": "boolean" - }, - "command": { - "type": "string", - "enum": [ - "start" - ] - } - }, - "additionalProperties": false - } - ] - }, - "interrupt_sync_command": { - "allOf": [ - { - "$ref": "#/components/schemas/abstract_sync_command" - }, - { - "type": "object", - "description": "Command to interrupt a synchronisation job for Content Source", - "properties": { - "command": { - "type": "string", - "enum": [ - "interrupt" - ] - } - }, - "additionalProperties": false - } - ] - }, - "sync_jobs_command": { - "anyOf": [ - { - "$ref": "#/components/schemas/start_sync_command" - }, - { - "$ref": "#/components/schemas/interrupt_sync_command" - } - ] - }, - "synonyms_page": { - "type": "object", - "description": "Paging controls for the result set", - "additionalProperties": false, - "default": { -}, - "properties": { - "size": { - "type": "integer", - "minimum": 1, - "maximum": 25, - "default": 25 - }, - "current": { - "type": "integer", - "minimum": 1, - "default": 1 - } - } - }, - "synonyms_terms_filter": { - "oneOf": [ - { - "type": "string" - }, - { - "type": "array", - "minItems": 1, - "items": { - "type": "string" - } - } - ] - }, - "synonyms_filter": { - "type": "object", - "description": "Filters to apply to the listing", - "additionalProperties": false, - "properties": { - "terms": { - "$ref": "#/components/schemas/synonyms_terms_filter" - } - } - }, - "synonyms_sort": { - "type": "object", - "description": "Field and direction to sort on", - "additionalProperties": false, - "properties": { - "created_at": { - "type": "string", - "enum": [ - "asc", - "desc" - ] - }, - "updated_at": { - "type": "string", - "enum": [ - "asc", - "desc" - ] - } - } - }, - "synonyms_list_definition": { - "type": "object", - "description": "", - "additionalProperties": false, - "properties": { - "page": { - "$ref": "#/components/schemas/synonyms_page" - }, - "sort": { - "$ref": "#/components/schemas/synonyms_sort" - }, - "filter": { - "$ref": "#/components/schemas/synonyms_filter" - } - } - }, - "bulk_synonym_sets": { - "description": "An array of sets to be created", - "type": "array", - "minItems": 1, - "maxItems": 100, - "items": { - "$ref": "#/components/schemas/single_synonym_set_object" - } - }, - "single_synonym_set_object": { - "description": "A single synonym set", - "type": "object", - "additionalProperties": false, - "properties": { - "synonyms": { - "$ref": "#/components/schemas/single_synonym_set" - } - } - }, - "single_synonym_set": { - "description": "A list of terms for this synonym set", - "type": "array", - "minItems": 2, - "items": { - "type": "string" - } - }, - "synonyms_create_definition": { - "type": "object", - "additionalProperties": false, - "properties": { - "synonyms": { - "$ref": "#/components/schemas/single_synonym_set" - }, - "synonym_sets": { - "$ref": "#/components/schemas/bulk_synonym_sets" - } - }, - "oneOf": [ - { - "required": [ - "synonyms" - ] - }, - { - "required": [ - "synonym_sets" - ] - } - ] - }, - "synonyms_update_definition": { - "type": "object", - "additionalProperties": false, - "properties": { - "synonyms": { - "description": "A list of terms for this synonym set", - "type": "array", - "minItems": 2, - "items": { - "type": "string" - } - } - }, - "required": [ - "synonyms" - ] - }, - "single_synonym_set_response": { - "type": "object", - "description": "A representation of a synonym set", - "properties": { - "id": { - "type": "string", - "description": "The id of the synonym set" - }, - "synonyms": { - "type": "array", - "items": { - "type": "string" - }, - "description": "The synonym terms for the set" - }, - "created_at": { - "type": "string", - "description": "The timestamp in ISO format when the set was created" - }, - "updated_at": { - "type": "string", - "description": "The timestamp in ISO format when the set was last updated" - } - } - }, - "list_synonym_set_response": { - "type": "object", - "description": "A list of synonym sets with metadata", - "properties": { - "meta": { - "type": "object", - "properties": { - "page": { - "type": "object", - "required": [ - "current", - "total_pages", - "total_results", - "size" - ], - "properties": { - "current": { - "type": "integer" - }, - "total_pages": { - "type": "integer" - }, - "total_results": { - "type": "integer" - }, - "size": { - "type": "integer" - } - } - }, - "filter": { - "type": "object", - "description": "Filters used for the listing", - "properties": { - "terms": { - "oneOf": [ - { - "type": "string", - "description": "The filter used (if any)" - }, - { - "type": "array", - "description": "Filter terms used (if any)", - "items": { - "type": "string" - } - } - ] - } - } - }, - "sort": { - "type": "object", - "description": "Any sorting applied to the result set", - "properties": { - "created_at": { - "enum": [ - "asc", - "desc" - ] - }, - "updated_at": { - "enum": [ - "asc", - "desc" - ] - } - } - } - } - }, - "results": { - "type": "array", - "description": "The synonym list results", - "items": { - "$ref": "#/components/schemas/single_synonym_set_response" - } - } - } - }, - "created_synonym_set_response": { - "type": "object", - "description": "A created synonym set with possible error information", - "properties": { - "id": { - "type": "string", - "description": "The id of the created set, or null if invalid" - }, - "synonyms": { - "type": "array", - "items": { - "type": "string" - }, - "description": "The synonym terms for the set" - }, - "errors": { - "type": "array", - "items": { - "type": "string" - }, - "description": "An optional array of error messages, if any" - } - } - }, - "batch_synonym_sets_response": { - "type": "object", - "description": "Response from a request to create a batch of synonym sets", - "properties": { - "has_errors": { - "type": "boolean", - "description": "True if any of the requested synonym sets have errors" - }, - "synonym_sets": { - "type": "array", - "description": "The synonym sets requested to be created", - "items": { - "$ref": "#/components/schemas/created_synonym_set_response" - } - } - } - }, - "content_source_icon_definition": { - "description": "Definition to upload Workplace Search Custom Source icons", - "type": "object", - "minProperties": 1, - "additionalProperties": false, - "properties": { - "main_icon": { - "type": "string", - "format": "byte", - "nullable": true - }, - "alt_icon": { - "type": "string", - "format": "byte", - "nullable": true - } - } - }, - "external_identity_create_definition": { - "description": "Definition to create Workplace Search External User Identity", - "type": "object", - "required": [ - "external_user_id", - "external_user_properties", - "permissions" - ], - "additionalProperties": false, - "properties": { - "external_user_id": { - "type": "string", - "minItems": 1 - }, - "external_user_properties": { - "type": "array", - "minItems": 0, - "maxItems": 1024, - "items": { - "$ref": "#/components/schemas/external_user_property" - }, - "description": "A list of external user properties, where each property is an object with an attribute_name and attribute_value." - }, - "permissions": { - "type": "array", - "minItems": 0, - "items": { - "$ref": "#/components/schemas/permission" - }, - "description": "A list of user permissions." - } - } - }, - "external_identity_update_definition": { - "description": "Definition to update Workplace Search External User Identity", - "type": "object", - "required": [ - "external_user_id" - ], - "minProperties": 2, - "additionalProperties": false, - "properties": { - "external_user_id": { - "type": "string", - "minItems": 1 - }, - "external_user_properties": { - "type": "array", - "nullable": true, - "minItems": 0, - "maxItems": 1024, - "items": { - "$ref": "#/components/schemas/external_user_property" - }, - "description": "A list of external user properties, where each property is an object with an attribute_name and attribute_value." - }, - "permissions": { - "type": "array", - "nullable": true, - "minItems": 0, - "items": { - "$ref": "#/components/schemas/permission" - }, - "description": "A list of user permissions." - } - } - }, - "range": { - "type": "object", - "minProperties": 1, - "additionalProperties": false, - "properties": { - "from": { - "description": "The start of the range, inclusive", - "type": "string" - }, - "to": { - "description": "The end of the range, exclusive", - "type": "string" - } - } - }, - "documents_delete_definition": { - "description": "Definition to delete documents by query in a content source", - "type": "object", - "additionalProperties": false, - "properties": { - "filters": { - "type": "object", - "additionalProperties": false, - "properties": { - "last_updated": { - "description": "The range filter for field last_updated", - "$ref": "#/components/schemas/range" - } - } - } - } - } - }, - "parameters": { - "content_source_id": { - "name": "content_source_id", - "schema": { - "type": "string" - }, - "in": "path", - "required": true, - "description": "Unique ID for a Custom API source, provided upon creation of a Custom API Source" - }, - "current_page": { - "name": "current_page", - "in": "query", - "schema": { - "type": "integer" - }, - "required": false, - "x-codegen-param-name": "currentPage", - "description": "Which page of results to request" - }, - "page_size": { - "name": "page_size", - "in": "query", - "schema": { - "type": "integer" - }, - "required": false, - "x-codegen-param-name": "pageSize", - "description": "The number of results to return in a page" - }, - "external_user_id": { - "name": "external_user_id", - "schema": { - "type": "string" - }, - "in": "path", - "required": true, - "description": "Unique identifier of an external user, such as username or email address." - }, - "document_id": { - "name": "id", - "schema": { - "type": "string", - "minLength": 1, - "maxLength": 487 - }, - "in": "path", - "required": true, - "description": "Unique ID for a content source document. Provided upon or returned at creation." - }, - "job_type": { - "name": "job_type", - "schema": { - "type": "array", - "collectionFormat": "csv", - "items": { - "enum": [ - "full", - "incremental", - "delete", - "permissions" - ] - } - }, - "in": "query", - "required": false, - "description": "The type of sync job to consider" - }, - "synonym_set_id": { - "description": "Synonym Set ID", - "in": "path", - "name": "synonym_set_id", - "required": true, - "schema": { - "type": "string" - } - } - } - }, - "security": [ - { - "basic_auth": [ - - ] - }, - { - "bearer_auth": [ - - ] - } - ], - "paths": { - "/api/ws/v1/sources": { - "post": { - "summary": "Create a content source", - "tags": [ - "Content Sources API" - ], - "description": "Create a custom content source", - "operationId": "createContentSource", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-content-sources-api.html#create-content-source-api" - }, - "parameters": [ - - ], - "responses": { - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/errors_response" - }, - { - "$ref": "#/components/schemas/content_source_partial_create_response" - } - ] - } - } - } - }, - "401": { - "description": "unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/content_source" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/content_source_create_definition" - } - } - }, - "required": true - } - }, - "get": { - "summary": "Retrieves all content sources", - "tags": [ - "Content Sources API" - ], - "description": "Retrieves all content sources", - "operationId": "listContentSources", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-content-sources-api.html#list-content-sources-api" - }, - "parameters": [ - { - "name": "page[current]", - "in": "query", - "$ref": "#/components/parameters/current_page", - "required": false, - "schema": { - "type": ["integer"] - } - }, - { - "name": "page[size]", - "in": "query", - "$ref": "#/components/parameters/page_size", - "required": false, - "schema": { - "type": "integer" - } - } - ], - "responses": { - "401": { - "description": "unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/list_content_sources_response" - } - } - } - } - } - } - }, - "/api/ws/v1/sources/{content_source_id}": { - "get": { - "summary": "Retrieves a content source by ID", - "tags": [ - "Content Sources API" - ], - "description": "Retrieves a content source by ID", - "operationId": "getContentSource", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-content-sources-api.html#get-content-source-api" - }, - "responses": { - "401": { - "description": "unauthorized" - }, - "404": { - "description": "not found" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/content_source" - } - } - } - } - } - }, - "put": { - "summary": "Update a content source", - "tags": [ - "Content Sources API" - ], - "description": "Update a content source", - "operationId": "putContentSource", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-content-sources-api.html#update-content-source-api" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - } - ], - "responses": { - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/errors_response" - }, - { - "$ref": "#/components/schemas/content_source_partial_update_response" - } - ] - } - } - } - }, - "401": { - "description": "unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/content_source" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/content_source_update_definition" - } - } - }, - "required": true - } - }, - "delete": { - "summary": "Deletes a content source by ID", - "tags": [ - "Content Sources API" - ], - "description": "Deletes a content source by ID", - "operationId": "deleteContentSource", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-content-sources-api.html#remove-content-source-api" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - } - ], - "responses": { - "401": { - "description": "unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "404": { - "description": "not found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/record_deleted_response" - } - } - } - } - } - } - }, - "/api/ws/v1/sources/{content_source_id}/icon": { - "put": { - "summary": "Upload content source icons", - "tags": [ - "Content Sources API" - ], - "description": "Upload content source icons", - "operationId": "putContentSourceIcons", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-content-sources-api.html#upload-content-source-icon-api" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - } - ], - "responses": { - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "401": { - "description": "unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/upload_icons_response" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/content_source_icon_definition" - } - } - }, - "required": true - } - } - }, - "/api/ws/v1/sources/{content_source_id}/documents": { - "delete": { - "summary": "Deletes documents by query in a custom content source", - "tags": [ - "Documents API" - ], - "description": "Deletes documents by query in a custom content source", - "operationId": "deleteDocumentsByQuery", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-custom-sources-api.html#delete-documents-by-query" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - } - ], - "responses": { - "401": { - "description": "unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "404": { - "description": "not found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/delete_documents_by_query_response" - } - } - } - }, - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/documents_delete_definition" - } - } - } - } - }, - "post": { - "summary": "Lists documents from a custom content source", - "tags": [ - "Documents API" - ], - "description": "Lists documents from a custom content source", - "operationId": "listDocuments", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-custom-sources-api.html#list-documents" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - } - ], - "responses": { - "401": { - "description": "unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "404": { - "description": "not found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/document_list_response" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/documents_api_query" - } - } - } - } - } - }, - "/api/ws/v1/sources/{content_source_id}/documents/bulk_create": { - "post": { - "summary": "Indexes one or more new documents into a custom content source, or updates one or more existing documents", - "tags": [ - "Documents API" - ], - "description": "Indexes one or more new documents into a custom content source, or updates one or more existing documents", - "operationId": "indexDocuments", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-custom-sources-api.html#index-and-update" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - } - ], - "x-codegen-request-body-name": "documents", - "responses": { - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "413": { - "description": "payload too large", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "401": { - "description": "unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "404": { - "description": "not found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/document_bulk_create_response" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/bulk_documents" - } - } - }, - "required": true - } - } - }, - "/api/ws/v1/sources/{content_source_id}/documents/bulk_destroy": { - "post": { - "summary": "Deletes a list of documents from a custom content source", - "tags": [ - "Documents API" - ], - "description": "Remove documents from a Custom API Source", - "operationId": "deleteDocuments", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-custom-sources-api.html#delete-by-id" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - } - ], - "x-codegen-request-body-name": "document_ids", - "responses": { - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "413": { - "description": "payload too large", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "401": { - "description": "unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "404": { - "description": "not found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/document_bulk_delete_response" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/document_ids" - } - } - }, - "required": true - } - } - }, - "/api/ws/v1/sources/{content_source_id}/documents/{document_id}": { - "get": { - "summary": "Retrieves a document by ID from the specified content source", - "tags": [ - "Documents API" - ], - "description": "Retrieves a document by ID from the specified content source", - "operationId": "getDocument", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-content-sources-api.html#get-document-by-id-api" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - }, - { - "name": "document_id", - "in": "path", - "$ref": "#/components/parameters/document_id", - "required": true - } - ], - "responses": { - "401": { - "description": "unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "404": { - "description": "not found", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/single_document_response" - } - } - } - } - } - } - }, - "/api/ws/v1/sources/{content_source_id}/external_identities": { - "get": { - "summary": "Retrieves all external identities", - "tags": [ - "External Identities API" - ], - "description": "Retrieves all external identities", - "operationId": "listExternalIdentities", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-external-identities-api.html#list-external-identities" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - }, - { - "name": "page[current]", - "in": "query", - "$ref": "#/components/parameters/current_page", - "required": false, - "schema": { - "type": "integer" - } - }, - { - "name": "page[size]", - "in": "query", - "$ref": "#/components/parameters/page_size", - "required": false, - "schema": { - "type": "integer" - } - } - ], - "responses": { - "401": { - "description": "unauthorized" - }, - "404": { - "description": "not found" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/list_external_identities_response" - } - } - } - } - } - }, - "post": { - "summary": "Adds a new external identity", - "tags": [ - "External Identities API" - ], - "description": "Adds a new external identity", - "operationId": "createExternalIdentity", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-external-identities-api.html#add-external-identity" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - } - ], - "responses": { - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response", - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "401": { - "description": "unauthorized" - }, - "404": { - "description": "not found" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/external_identity" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/external_identity_create_definition" - } - } - }, - "required": true - } - } - }, - "/api/ws/v1/sources/{content_source_id}/external_identities/{external_user_id}": { - "get": { - "summary": "Retrieves an external identity", - "tags": [ - "External Identities API" - ], - "description": "Retrieves an external identity", - "operationId": "getExternalIdentity", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-external-identities-api.html#show-external-identity" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - }, - { - "name": "external_user_id", - "in": "path", - "$ref": "#/components/parameters/external_user_id", - "required": true - } - ], - "responses": { - "401": { - "description": "unauthorized" - }, - "404": { - "description": "not found" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/external_identity" - } - } - } - } - } - }, - "put": { - "summary": "Updates an external identity", - "tags": [ - "External Identities API" - ], - "description": "Updates an external identity", - "operationId": "putExternalIdentity", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-external-identities-api.html#update-external-identity" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - }, - { - "name": "external_user_id", - "in": "path", - "$ref": "#/components/parameters/external_user_id", - "required": true - } - ], - "responses": { - "401": { - "description": "unauthorized" - }, - "404": { - "description": "not found" - }, - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/external_identity" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/external_identity_update_definition" - } - } - }, - "required": true - } - }, - "delete": { - "summary": "Deletes an external identity", - "tags": [ - "External Identities API" - ], - "description": "Deletes an external identity", - "operationId": "deleteExternalIdentity", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-external-identities-api.html#remove-external-identity" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - }, - { - "name": "external_user_id", - "in": "path", - "$ref": "#/components/parameters/external_user_id", - "required": true - } - ], - "responses": { - "401": { - "description": "unauthorized" - }, - "404": { - "description": "not found" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/delete_external_identities_response" - } - } - } - } - } - } - }, - "/api/ws/v1/sources/{content_source_id}/sync/jobs": { - "post": { - "summary": "Issue commands to a Content Source's sync jobs", - "tags": [ - "Sync Jobs API" - ], - "description": "Control a content source's sync jobs", - "operationId": "commandSyncJobs", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-sync-jobs-api.html#command-sync-jobs-api" - }, - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - }, - { - "name": "job_type", - "in": "query", - "$ref": "#/components/parameters/job_type", - "required": false, - "schema": { - "type": "array" - } - } - ], - "responses": { - "401": { - "description": "unauthorized" - }, - "402": { - "description": "payment required" - }, - "404": { - "description": "not found" - }, - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/sync_jobs_command_response" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/sync_jobs_command" - } - } - }, - "required": true - } - } - }, - "/api/ws/v1/synonyms/{synonym_set_id}": { - "get": { - "summary": "Retrieve a synonym set by ID", - "tags": [ - "Synonyms API" - ], - "description": "Retrieve a synonym set by ID", - "operationId": "getSynonymSet", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-synonyms-api.html#show-synonym" - }, - "parameters": [ - { - "name": "synonym_set_id", - "in": "path", - "$ref": "#/components/parameters/synonym_set_id", - "required": true - } - ], - "responses": { - "401": { - "description": "unauthorized" - }, - "404": { - "description": "not found" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/single_synonym_set_response" - } - } - } - } - } - }, - "put": { - "summary": "Update a synonym set", - "tags": [ - "Synonyms API" - ], - "description": "Update a synonym set", - "operationId": "putSynonymSet", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-synonyms-api.html#update-synonym" - }, - "parameters": [ - { - "name": "synonym_set_id", - "in": "path", - "$ref": "#/components/parameters/synonym_set_id", - "required": true - } - ], - "responses": { - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "401": { - "description": "unauthorized" - }, - "404": { - "description": "not found" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/single_synonym_set_response" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/synonyms_update_definition" - } - } - }, - "required": true - } - }, - "delete": { - "summary": "Delete a synonym set", - "tags": [ - "Synonyms API" - ], - "description": "Delete a synonym set", - "operationId": "deleteSynonymSet", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-synonyms-api.html#delete-synonym" - }, - "parameters": [ - { - "name": "synonym_set_id", - "in": "path", - "$ref": "#/components/parameters/synonym_set_id", - "required": true - } - ], - "responses": { - "401": { - "description": "unauthorized" - }, - "404": { - "description": "not found" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/record_deleted_response" - } - } - } - } - } - } - }, - "/api/ws/v1/synonyms": { - "get": { - "summary": "Retrieves all synonym sets", - "tags": [ - "Synonyms API" - ], - "description": "Retrieve a list of synonym sets", - "operationId": "listSynonymSets", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-synonyms-api.html#list-synonyms" - }, - "parameters": [ - - ], - "responses": { - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "401": { - "description": "unauthorized" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/list_synonym_set_response" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/synonyms_list_definition" - } - } - } - } - }, - "post": { - "summary": "Create a batch of synonym sets", - "tags": [ - "Synonyms API" - ], - "description": "Create batched synonym sets", - "operationId": "createBatchSynonymSets", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-synonyms-api.html#create-synonyms" - }, - "parameters": [ - - ], - "responses": { - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "401": { - "description": "unauthorized" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/batch_synonym_sets_response" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/synonyms_create_definition" - } - } - }, - "required": true - } - } - }, - "/api/ws/v1/automatic_query_refinement": { - "get": { - "summary": "Get current triggers blocklist", - "description": "Get current triggers blocklist", - "operationId": "getTriggersBlocklist", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/automatic-query-refinement-blocklist.html" - }, - "responses": { - "401": { - "description": "unauthorized" - }, - "404": { - "description": "not found" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/triggers_blocklist_wrapper_definition" - } - } - } - } - } - }, - "put": { - "summary": "Update current triggers blocklist", - "description": "Update current triggers blocklist", - "operationId": "putTriggersBlocklist", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/automatic-query-refinement-blocklist.html" - }, - "parameters": [ - - ], - "responses": { - "401": { - "description": "unauthorized" - }, - "404": { - "description": "not found" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "example": { - "blocklist": [ - "one", - "two", - "three" - ] - }, - "schema": { - "$ref": "#/components/schemas/triggers_blocklist_wrapper_definition" - } - } - } - }, - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - } - } - } - }, - "/api/ws/v1/sources/{content_source_id}/automatic_query_refinement": { - "get": { - "summary": "Retrieves a content source's automatic query refinement details", - "tags": [ - "Content Sources API" - ], - "description": "Retrieves a content source's automatic query refinement details", - "operationId": "getAutoQueryRefinementDetails", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "parameters": [ - { - "name": "content_source_id", - "in": "path", - "$ref": "#/components/parameters/content_source_id", - "required": true - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-content-sources-api.html#get-automatic-query-refinement-details-api" - }, - "responses": { - "401": { - "description": "unauthorized" - }, - "404": { - "description": "not found" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/automatic_query_refinement_details_response" - } - } - } - } - } - } - }, - "/api/ws/v1/whoami": { - "get": { - "summary": "Get the authenticated user", - "description": "Get the authenticated user", - "operationId": "getCurrentUser", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-user-api.html#get-current-user-api" - }, - "responses": { - "401": { - "description": "unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/whoami_response" - } - } - } - } - } - } - }, - "/api/ws/v1/analytics/event": { - "post": { - "summary": "Capture click and feedback analytic events", - "tags": [ - "Analytics API" - ], - "description": "Capture Analytic events for click and feedback", - "operationId": "createAnalyticsEvent", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "parameters": [ - - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-analytics-api.html" - }, - "responses": { - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "401": { - "description": "unauthorized" - }, - "200": { - "description": "ok" - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/analytics_event" - } - } - }, - "required": true - } - } - }, - "/api/ws/v1/search": { - "post": { - "summary": "Search across available sources with various query tuning options", - "tags": [ - "Search API" - ], - "description": "Issue a Search Query", - "operationId": "search", - "security": [ - { - "bearer_auth": [ - - ] - } - ], - "parameters": [ - - ], - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-search-api.html" - }, - "responses": { - "400": { - "description": "bad request", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/errors_response" - } - } - } - }, - "401": { - "description": "unauthorized" - }, - "200": { - "description": "ok", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/search_api_endpoint_response" - } - } - } - } - }, - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/search_api_query" - } - } - }, - "required": true - } - } - } - }, - "tags": [ - { - "name": "Documents API", - "description": "Index, update, and destroy documents from a Custom API Source", - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-custom-sources-api.html" - } - }, - { - "name": "Search API", - "description": "Comprehensive endpoint to issue search queries and retrieve results", - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-search-api.html" - } - }, - { - "name": "Analytics API", - "description": "Allows logging of analytic events for click and feedback results via API", - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-analytics-api.html" - } - }, - { - "name": "External Identities API", - "description": "Add, remove, and list mappings between External Source Identities and Internal Users", - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-external-identities-api.html" - } - }, - { - "name": "Content Sources API", - "description": "Add, update, remove, list, and show Content Sources", - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-content-sources-api.html" - } - }, - { - "name": "Sync Jobs API", - "description": "Interact with Content Source sync jobs", - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-sync-jobs-api.html" - } - }, - { - "name": "Synonyms API", - "description": "Add, update, remove, list, and show Synonyms", - "externalDocs": { - "url": "https://www.elastic.co/guide/en/workplace-search/current/workplace-search-synonyms-api.html" - } - } - ] -}