diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/DeleteByQueryOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/DeleteByQueryOverrides.cs index a14ebe66e2..9974254760 100644 --- a/src/ApiGenerator/Configuration/Overrides/Endpoints/DeleteByQueryOverrides.cs +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/DeleteByQueryOverrides.cs @@ -32,6 +32,6 @@ namespace ApiGenerator.Configuration.Overrides.Endpoints { public class DeleteByQueryOverrides : EndpointOverridesBase { - public override IEnumerable SkipQueryStringParams => new[] { "max_docs", }; + public override IEnumerable SkipQueryStringParams => ["max_docs", "slices"]; } } diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/ReindexOnServerOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/ReindexOnServerOverrides.cs index ebdffd7dc8..32ad62938f 100644 --- a/src/ApiGenerator/Configuration/Overrides/Endpoints/ReindexOnServerOverrides.cs +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/ReindexOnServerOverrides.cs @@ -32,6 +32,6 @@ namespace ApiGenerator.Configuration.Overrides.Endpoints { public class ReindexOnServerOverrides : EndpointOverridesBase { - public override IEnumerable SkipQueryStringParams => new[] { "max_docs", }; + public override IEnumerable SkipQueryStringParams => ["max_docs", "slices"]; } } diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/SearchOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/SearchOverrides.cs index 2e728e4bfc..34d549c29c 100644 --- a/src/ApiGenerator/Configuration/Overrides/Endpoints/SearchOverrides.cs +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/SearchOverrides.cs @@ -33,8 +33,8 @@ namespace ApiGenerator.Configuration.Overrides.Endpoints // ReSharper disable once UnusedMember.Global public class SearchOverrides : EndpointOverridesBase { - public override IEnumerable SkipQueryStringParams => new[] - { + public override IEnumerable SkipQueryStringParams => + [ "size", "from", "timeout", @@ -45,12 +45,8 @@ public class SearchOverrides : EndpointOverridesBase "_source_includes", "_source_excludes", "track_scores", - "terminate_after", - }; - - public override IEnumerable RenderPartial => new[] - { - "track_total_hits" - }; + "track_total_hits", + "terminate_after" + ]; } } diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/UpdateByQueryOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/UpdateByQueryOverrides.cs index 316231d1dd..866f5e086d 100644 --- a/src/ApiGenerator/Configuration/Overrides/Endpoints/UpdateByQueryOverrides.cs +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/UpdateByQueryOverrides.cs @@ -32,6 +32,6 @@ namespace ApiGenerator.Configuration.Overrides.Endpoints { public class UpdateByQueryOverrides : EndpointOverridesBase { - public override IEnumerable SkipQueryStringParams => new[] { "max_docs", }; + public override IEnumerable SkipQueryStringParams => ["max_docs", "slices"]; } } diff --git a/src/ApiGenerator/Domain/Code/HttpMethod.cs b/src/ApiGenerator/Domain/Code/HttpMethod.cs index 390aa1e7e1..c45c63f382 100644 --- a/src/ApiGenerator/Domain/Code/HttpMethod.cs +++ b/src/ApiGenerator/Domain/Code/HttpMethod.cs @@ -15,7 +15,7 @@ public class HttpMethod public static readonly HttpMethod Patch = new("Patch", true); public static readonly HttpMethod Post = new("Post", true); public static readonly HttpMethod Put = new("Put", true); - public static readonly HttpMethod[] All = { Delete, Get, Head, Patch, Post, Put }; + public static readonly HttpMethod[] All = [Delete, Get, Head, Patch, Post, Put]; private readonly string _method; diff --git a/src/ApiGenerator/Domain/Specification/ApiEndpoint.cs b/src/ApiGenerator/Domain/Specification/ApiEndpoint.cs index f22c15731f..daf1edb31b 100644 --- a/src/ApiGenerator/Domain/Specification/ApiEndpoint.cs +++ b/src/ApiGenerator/Domain/Specification/ApiEndpoint.cs @@ -39,7 +39,7 @@ namespace ApiGenerator.Domain.Specification { public class ApiEndpoint { - /// The original name as declared in the spec + /// The original name as declared in the spec public string Name { get; set; } /// The original namespace as declared in the spec @@ -63,102 +63,121 @@ public class ApiEndpoint public IEndpointOverrides Overrides { get; internal set; } - private IEnumerable ParamsToGenerate => Url.Params.Values.Where(p => !p.Skip).OrderBy(p => p.ClsName); - - public RequestInterface RequestInterface => new() - { - CsharpNames = CsharpNames, - UrlParts = Url.Parts, - PartialParameters = - Body == null ? Enumerable.Empty().ToList() : ParamsToGenerate.Where(p => p.RenderPartial).ToList(), - OfficialDocumentationLink = OfficialDocumentationLink?.Url - }; - - public RequestPartialImplementation RequestPartialImplementation => new() - { - CsharpNames = CsharpNames, - OfficialDocumentationLink = OfficialDocumentationLink?.Url, - Stability = Stability, - Paths = Url.Paths.ToList(), - Parts = Url.Parts, - Params = ParamsToGenerate.ToList(), - Constructors = Constructor.RequestConstructors(CsharpNames, Url, inheritsFromPlainRequestBase: true).ToList(), - GenericConstructors = Constructor.RequestConstructors(CsharpNames, Url, inheritsFromPlainRequestBase: false).ToList(), - HasBody = Body != null, - }; - - public DescriptorPartialImplementation DescriptorPartialImplementation => new() - { - CsharpNames = CsharpNames, - OfficialDocumentationLink = OfficialDocumentationLink?.Url, - Constructors = Constructor.DescriptorConstructors(CsharpNames, Url).ToList(), - Paths = Url.Paths.ToList(), - Parts = Url.Parts, - Params = ParamsToGenerate.ToList(), - HasBody = Body != null, - }; - - public RequestParameterImplementation RequestParameterImplementation => new() - { - CsharpNames = CsharpNames, - OfficialDocumentationLink = OfficialDocumentationLink?.Url, - Params = ParamsToGenerate.ToList(), - HttpMethod = PreferredHttpMethod - }; + private IEnumerable ParamsToGenerate => + Url.Params.Values.Where(p => !p.Skip).OrderBy(p => p.ClsName); - public string PreferredHttpMethod => - HttpMethods.OrderByDescending(m => m switch + public RequestInterface RequestInterface => + new() + { + CsharpNames = CsharpNames, + UrlParts = Url.Parts, + PartialParameters = + Body == null + ? Enumerable.Empty().ToList() + : ParamsToGenerate.Where(p => p.RenderPartial).ToList(), + OfficialDocumentationLink = OfficialDocumentationLink?.Url, + }; + + public RequestPartialImplementation RequestPartialImplementation => + new() + { + CsharpNames = CsharpNames, + OfficialDocumentationLink = OfficialDocumentationLink?.Url, + Stability = Stability, + Paths = Url.Paths.ToList(), + Parts = Url.Parts, + Params = ParamsToGenerate.ToList(), + Constructors = Constructor + .RequestConstructors(CsharpNames, Url, inheritsFromPlainRequestBase: true) + .ToList(), + GenericConstructors = Constructor + .RequestConstructors(CsharpNames, Url, inheritsFromPlainRequestBase: false) + .ToList(), + HasBody = Body != null, + }; + + public DescriptorPartialImplementation DescriptorPartialImplementation => + new() + { + CsharpNames = CsharpNames, + OfficialDocumentationLink = OfficialDocumentationLink?.Url, + Constructors = Constructor.DescriptorConstructors(CsharpNames, Url).ToList(), + Paths = Url.Paths.ToList(), + Parts = Url.Parts, + Params = ParamsToGenerate.ToList(), + HasBody = Body != null, + }; + + public RequestParameterImplementation RequestParameterImplementation => + new() { - "GET" => 0, - "POST" => 1, - "PUT" or "DELETE" or "PATCH" or "HEAD" => 2, // Prefer "resource" methods over GET/POST methods - _ => -1 - }).First(); + CsharpNames = CsharpNames, + OfficialDocumentationLink = OfficialDocumentationLink?.Url, + Params = ParamsToGenerate.ToList(), + HttpMethod = PreferredHttpMethod, + }; + + public string PreferredHttpMethod => + Name == "bulk" + ? "POST" + : HttpMethods + .OrderByDescending(m => + m switch + { + "GET" => 0, + "POST" => 1, + "PUT" or "DELETE" or "PATCH" or "HEAD" => 2, // Prefer "resource" methods over GET/POST methods + _ => -1, + } + ) + .First(); public string HighLevelMethodXmlDocDescription => $"{PreferredHttpMethod} request to the {Name} API, read more about this API online:"; - private bool BodyIsOptional => Body is not { Required: true } || HttpMethods.Contains("GET"); - - private Deprecation Deprecated => - !Url.Paths.Any() && Url.AllPaths.Count > 0 - ? Url.DeprecatedPaths - .Select(p => p.Deprecation) - .MaxBy(d => d.Version) - : null; - - private Version VersionAdded => - Url.AllPaths - .Select(p => p.VersionAdded) - .Where(v => v != null) - .Min(); - - public HighLevelModel HighLevelModel => new() - { - CsharpNames = CsharpNames, - Fluent = new FluentMethod(CsharpNames, Url.Parts, - selectorIsOptional: BodyIsOptional, - link: OfficialDocumentationLink?.Url, - summary: HighLevelMethodXmlDocDescription, - deprecated: Deprecated, - versionAdded: VersionAdded - ), - FluentBound = !CsharpNames.DescriptorBindsOverMultipleDocuments - ? null - : new BoundFluentMethod(CsharpNames, Url.Parts, + private bool BodyIsOptional => + Body is not { Required: true } || HttpMethods.Contains("GET"); + + private Deprecation Deprecated => + !Url.Paths.Any() && Url.AllPaths.Count > 0 + ? Url.DeprecatedPaths.Select(p => p.Deprecation).MaxBy(d => d.Version) + : null; + + private Version VersionAdded => + Url.AllPaths.Select(p => p.VersionAdded).Where(v => v != null).Min(); + + public HighLevelModel HighLevelModel => + new() + { + CsharpNames = CsharpNames, + Fluent = new FluentMethod( + CsharpNames, + Url.Parts, selectorIsOptional: BodyIsOptional, link: OfficialDocumentationLink?.Url, summary: HighLevelMethodXmlDocDescription, - deprecated: Deprecated, - versionAdded: VersionAdded + deprecated: Deprecated, + versionAdded: VersionAdded + ), + FluentBound = !CsharpNames.DescriptorBindsOverMultipleDocuments + ? null + : new BoundFluentMethod( + CsharpNames, + Url.Parts, + selectorIsOptional: BodyIsOptional, + link: OfficialDocumentationLink?.Url, + summary: HighLevelMethodXmlDocDescription, + deprecated: Deprecated, + versionAdded: VersionAdded + ), + Initializer = new InitializerMethod( + CsharpNames, + link: OfficialDocumentationLink?.Url, + summary: HighLevelMethodXmlDocDescription, + deprecated: Deprecated, + versionAdded: VersionAdded ), - Initializer = new InitializerMethod(CsharpNames, - link: OfficialDocumentationLink?.Url, - summary: HighLevelMethodXmlDocDescription, - deprecated: Deprecated, - versionAdded: VersionAdded - ) - }; + }; private List _lowLevelClientMethods; @@ -166,7 +185,8 @@ public IReadOnlyCollection LowLevelClientMethods { get { - if (_lowLevelClientMethods != null && _lowLevelClientMethods.Count > 0) return _lowLevelClientMethods; + if (_lowLevelClientMethods != null && _lowLevelClientMethods.Count > 0) + return _lowLevelClientMethods; // enumerate once and cache _lowLevelClientMethods = new List(); @@ -183,11 +203,19 @@ public IReadOnlyCollection LowLevelClientMethods // TODO This is hack until we stop transforming the new spec format into the old if (Name == "index" && !mapsApiArgumentHints.Contains("id")) httpMethod = "POST"; - else if (Name == "index") httpMethod = PreferredHttpMethod; + else if (Name == "index") + httpMethod = PreferredHttpMethod; if (Body != null) { - parts.Add(new UrlPart { Name = "body", Type = "PostData", Description = Body.Description }); + parts.Add( + new UrlPart + { + Name = "body", + Type = "PostData", + Description = Body.Description, + } + ); mapsApiArgumentHints.Add("body"); } @@ -210,7 +238,7 @@ public IReadOnlyCollection LowLevelClientMethods Parts = parts, Url = Url, HasBody = Body != null, - VersionAdded = path.VersionAdded, + VersionAdded = path.VersionAdded, }; _lowLevelClientMethods.Add(apiMethod); } diff --git a/src/ApiGenerator/Domain/Specification/UrlPart.cs b/src/ApiGenerator/Domain/Specification/UrlPart.cs index 4f3450af85..353fa190a2 100644 --- a/src/ApiGenerator/Domain/Specification/UrlPart.cs +++ b/src/ApiGenerator/Domain/Specification/UrlPart.cs @@ -49,8 +49,8 @@ public string LowLevelTypeName return Type; case "list": return "string"; - case "enum": - return Name.ToPascalCase(); + case "IndicesStatsMetric?": + return "string"; default: return Type; } diff --git a/src/ApiGenerator/Generator/ApiEndpointFactory.cs b/src/ApiGenerator/Generator/ApiEndpointFactory.cs index 65302b43d2..dc728188d0 100644 --- a/src/ApiGenerator/Generator/ApiEndpointFactory.cs +++ b/src/ApiGenerator/Generator/ApiEndpointFactory.cs @@ -242,8 +242,8 @@ private static string GetOpenSearchType(JsonSchema schema, Action { case ("string", "list"): return second; case ("boolean", "string"): return first; - case ("string", "number"): return first; case ("number", _): return "string"; + case (_,"number"): return "string"; } } } diff --git a/src/ApiGenerator/Views/LowLevel/Client/Interface/IOpenSearchLowLevelClient.cshtml b/src/ApiGenerator/Views/LowLevel/Client/Interface/IOpenSearchLowLevelClient.cshtml index 399f4984f7..d8e2c1db1e 100644 --- a/src/ApiGenerator/Views/LowLevel/Client/Interface/IOpenSearchLowLevelClient.cshtml +++ b/src/ApiGenerator/Views/LowLevel/Client/Interface/IOpenSearchLowLevelClient.cshtml @@ -35,7 +35,7 @@ namespace OpenSearch.Net } - if(Model.EndpointsPerNamespaceHighLevel.TryGetValue(CsharpNames.RootNamespace, out var endpoints)) + if(Model.EndpointsPerNamespaceLowLevel.TryGetValue(CsharpNames.RootNamespace, out var endpoints)) { foreach(var m in endpoints.SelectMany(e => e.LowLevelClientMethods)) { diff --git a/src/ApiGenerator/opensearch-openapi.yaml b/src/ApiGenerator/opensearch-openapi.yaml index 9fe91324a3..e00bfa8866 100644 --- a/src/ApiGenerator/opensearch-openapi.yaml +++ b/src/ApiGenerator/opensearch-openapi.yaml @@ -3737,15 +3737,35 @@ paths: - $ref: '#/components/parameters/_global::query.error_trace' - $ref: '#/components/parameters/_global::query.source' - $ref: '#/components/parameters/_global::query.filter_path' - /_plugins/_ism/add/{index}: + /_plugins/_ism/add: post: operationId: ism.add_policy.0 x-operation-group: ism.add_policy description: Adds a policy to an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#add-policy + parameters: + - $ref: '#/components/parameters/ism.add_policy::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.add_policy' + responses: + '200': + $ref: '#/components/responses/ism.add_policy@200' + /_plugins/_ism/add/{index}: + post: + operationId: ism.add_policy.1 + x-operation-group: ism.add_policy + description: Adds a policy to an index. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#add-policy parameters: - $ref: '#/components/parameters/ism.add_policy::path.index' + - $ref: '#/components/parameters/ism.add_policy::query.index' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -3756,15 +3776,35 @@ paths: responses: '200': $ref: '#/components/responses/ism.add_policy@200' - /_plugins/_ism/change_policy/{index}: + /_plugins/_ism/change_policy: post: operationId: ism.change_policy.0 x-operation-group: ism.change_policy description: Updates the managed index policy to a new policy. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#update-managed-index-policy + parameters: + - $ref: '#/components/parameters/ism.change_policy::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.change_policy' + responses: + '200': + $ref: '#/components/responses/ism.change_policy@200' + /_plugins/_ism/change_policy/{index}: + post: + operationId: ism.change_policy.1 + x-operation-group: ism.change_policy + description: Updates the managed index policy to a new policy. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#update-managed-index-policy parameters: - $ref: '#/components/parameters/ism.change_policy::path.index' + - $ref: '#/components/parameters/ism.change_policy::query.index' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -3775,15 +3815,106 @@ paths: responses: '200': $ref: '#/components/responses/ism.change_policy@200' + /_plugins/_ism/explain: + get: + operationId: ism.explain_policy.0 + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + post: + operationId: ism.explain_policy.0 + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' /_plugins/_ism/explain/{index}: get: - operationId: ism.explain_index.0 - x-operation-group: ism.explain_index - description: Gets the currently applied policy on an index. + operationId: ism.explain_policy.1 + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index parameters: - - $ref: '#/components/parameters/ism.explain_index::path.index' + - $ref: '#/components/parameters/ism.explain_policy::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + post: + operationId: ism.explain_policy.1 + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + parameters: + - $ref: '#/components/parameters/ism.explain_policy::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + /_plugins/_ism/policies: + get: + operationId: ism.get_policies.0 + x-operation-group: ism.get_policies + description: Gets the policies. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy + responses: + '200': + $ref: '#/components/responses/ism.get_policies@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + put: + operationId: ism.put_policies.0 + x-operation-group: ism.put_policies + description: Gets the policies. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#create-policy + requestBody: + $ref: '#/components/requestBodies/ism.put_policies' + parameters: + - $ref: '#/components/parameters/ism.put_policies::query.if_primary_term' + - $ref: '#/components/parameters/ism.put_policies::query.if_seq_no' + - $ref: '#/components/parameters/ism.put_policies::query.policyID' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -3791,7 +3922,7 @@ paths: - $ref: '#/components/parameters/_global::query.filter_path' responses: '200': - $ref: '#/components/responses/ism.explain_index@200' + $ref: '#/components/responses/ism.put_policies@200' /_plugins/_ism/policies/{policy_id}: delete: operationId: ism.delete_policy.0 @@ -3812,9 +3943,9 @@ paths: get: operationId: ism.get_policy.0 x-operation-group: ism.get_policy - description: Gets the policy. + description: Gets a policy. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#put-policy parameters: - $ref: '#/components/parameters/ism.get_policy::path.policy_id' - $ref: '#/components/parameters/_global::query.pretty' @@ -3825,6 +3956,24 @@ paths: responses: '200': $ref: '#/components/responses/ism.get_policy@200' + head: + operationId: ism.exists_policy.0 + x-operation-group: ism.exists_policy + description: Checks whether the policy exists. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy + parameters: + - $ref: '#/components/parameters/ism.exists_policy::path.policy_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.exists_policy@200' + '404': + $ref: '#/components/responses/ism.exists_policy@404' put: operationId: ism.put_policy.0 x-operation-group: ism.put_policy @@ -3847,15 +3996,33 @@ paths: $ref: '#/components/responses/ism.put_policy@200' '201': $ref: '#/components/responses/ism.put_policy@201' - /_plugins/_ism/remove/{index}: + /_plugins/_ism/remove: post: operationId: ism.remove_policy.0 x-operation-group: ism.remove_policy description: Removes a policy from an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#remove-policy + parameters: + - $ref: '#/components/parameters/ism.remove_policy::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.remove_policy@200' + /_plugins/_ism/remove/{index}: + post: + operationId: ism.remove_policy.1 + x-operation-group: ism.remove_policy + description: Removes a policy from an index. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#remove-policy parameters: - $ref: '#/components/parameters/ism.remove_policy::path.index' + - $ref: '#/components/parameters/ism.remove_policy::query.index' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -3864,6 +4031,45 @@ paths: responses: '200': $ref: '#/components/responses/ism.remove_policy@200' + /_plugins/_ism/retry: + post: + operationId: ism.retry_index.0 + x-operation-group: ism.retry_index + description: Retry the failed action for an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#retry-failed-index + parameters: + - $ref: '#/components/parameters/ism.retry_index::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.retry_index' + responses: + '200': + $ref: '#/components/responses/ism.retry_index@200' + /_plugins/_ism/retry/{index}: + post: + operationId: ism.retry_index.1 + x-operation-group: ism.retry_index + description: Retry the failed action for an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#retry-failed-index + parameters: + - $ref: '#/components/parameters/ism.retry_index::path.index' + - $ref: '#/components/parameters/ism.retry_index::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.retry_index' + responses: + '200': + $ref: '#/components/responses/ism.retry_index@200' /_plugins/_knn/{node_id}/stats: get: operationId: knn.stats.2 @@ -4826,6 +5032,23 @@ paths: responses: '200': $ref: '#/components/responses/sql.settings@200' + /_plugins/_refresh_search_analyzers/{index}: + post: + operationId: ism.refresh_search_analyzers.0 + x-operation-group: ism.refresh_search_analyzers + description: Refresh search analyzers in real time. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/refresh-analyzer/ + parameters: + - $ref: '#/components/parameters/ism.refresh_search_analyzers::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.refresh_search_analyzers@200' /_plugins/_rollup/jobs/{id}: delete: operationId: rollups.delete.0 @@ -7334,6 +7557,7 @@ paths: parameters: - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::query.cluster_manager_timeout' + - $ref: '#/components/parameters/put_script::query.context' - $ref: '#/components/parameters/put_script::query.master_timeout' - $ref: '#/components/parameters/put_script::query.timeout' - $ref: '#/components/parameters/_global::query.pretty' @@ -7356,6 +7580,7 @@ paths: parameters: - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::query.cluster_manager_timeout' + - $ref: '#/components/parameters/put_script::query.context' - $ref: '#/components/parameters/put_script::query.master_timeout' - $ref: '#/components/parameters/put_script::query.timeout' - $ref: '#/components/parameters/_global::query.pretty' @@ -7380,6 +7605,7 @@ paths: - $ref: '#/components/parameters/put_script::path.context' - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::query.cluster_manager_timeout' + - $ref: '#/components/parameters/put_script::query.context' - $ref: '#/components/parameters/put_script::query.master_timeout' - $ref: '#/components/parameters/put_script::query.timeout' - $ref: '#/components/parameters/_global::query.pretty' @@ -7403,6 +7629,7 @@ paths: - $ref: '#/components/parameters/put_script::path.context' - $ref: '#/components/parameters/put_script::path.id' - $ref: '#/components/parameters/put_script::query.cluster_manager_timeout' + - $ref: '#/components/parameters/put_script::query.context' - $ref: '#/components/parameters/put_script::query.master_timeout' - $ref: '#/components/parameters/put_script::query.timeout' - $ref: '#/components/parameters/_global::query.pretty' @@ -11482,15 +11709,37 @@ paths: $ref: '#/components/responses/asynchronous_search.delete@200' deprecated: true x-ignorable: true - /_opendistro/_ism/add/{index}: + /_opendistro/_ism/add: post: operationId: ism.add_policy.0_superseded x-operation-group: ism.add_policy description: Adds a policy to an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#add-policy + parameters: + - $ref: '#/components/parameters/ism.add_policy::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.add_policy' + responses: + '200': + $ref: '#/components/responses/ism.add_policy@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/add/{index}: + post: + operationId: ism.add_policy.1_superseded + x-operation-group: ism.add_policy + description: Adds a policy to an index. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#add-policy parameters: - $ref: '#/components/parameters/ism.add_policy::path.index' + - $ref: '#/components/parameters/ism.add_policy::query.index' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -11503,15 +11752,37 @@ paths: $ref: '#/components/responses/ism.add_policy@200' deprecated: true x-ignorable: true - /_opendistro/_ism/change_policy/{index}: + /_opendistro/_ism/change_policy: post: operationId: ism.change_policy.0_superseded x-operation-group: ism.change_policy description: Updates the managed index policy to a new policy. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#update-managed-index-policy + parameters: + - $ref: '#/components/parameters/ism.change_policy::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.change_policy' + responses: + '200': + $ref: '#/components/responses/ism.change_policy@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/change_policy/{index}: + post: + operationId: ism.change_policy.1_superseded + x-operation-group: ism.change_policy + description: Updates the managed index policy to a new policy. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#update-managed-index-policy parameters: - $ref: '#/components/parameters/ism.change_policy::path.index' + - $ref: '#/components/parameters/ism.change_policy::query.index' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -11524,15 +11795,116 @@ paths: $ref: '#/components/responses/ism.change_policy@200' deprecated: true x-ignorable: true + /_opendistro/_ism/explain: + get: + operationId: ism.explain_policy.0_superseded + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + deprecated: true + x-ignorable: true + post: + operationId: ism.explain_policy.0_superseded + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + deprecated: true + x-ignorable: true /_opendistro/_ism/explain/{index}: get: - operationId: ism.explain_index.0_superseded - x-operation-group: ism.explain_index - description: Gets the currently applied policy on an index. + operationId: ism.explain_policy.1_superseded + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index + parameters: + - $ref: '#/components/parameters/ism.explain_policy::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + deprecated: true + x-ignorable: true + post: + operationId: ism.explain_policy.1_superseded + x-operation-group: ism.explain_policy + description: Gets the currently applied policy on indices. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#explain-index parameters: - - $ref: '#/components/parameters/ism.explain_index::path.index' + - $ref: '#/components/parameters/ism.explain_policy::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.explain_policy' + responses: + '200': + $ref: '#/components/responses/ism.explain_policy@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/policies: + get: + operationId: ism.get_policies.0_superseded + x-operation-group: ism.get_policies + description: Gets the policies. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy + responses: + '200': + $ref: '#/components/responses/ism.get_policies@200' + parameters: + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + deprecated: true + x-ignorable: true + put: + operationId: ism.put_policies.0_superseded + x-operation-group: ism.put_policies + description: Gets the policies. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#create-policy + requestBody: + $ref: '#/components/requestBodies/ism.put_policies' + parameters: + - $ref: '#/components/parameters/ism.put_policies::query.if_primary_term' + - $ref: '#/components/parameters/ism.put_policies::query.if_seq_no' + - $ref: '#/components/parameters/ism.put_policies::query.policyID' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -11540,16 +11912,16 @@ paths: - $ref: '#/components/parameters/_global::query.filter_path' responses: '200': - $ref: '#/components/responses/ism.explain_index@200' + $ref: '#/components/responses/ism.put_policies@200' deprecated: true x-ignorable: true /_opendistro/_ism/policies/{policyID}: get: operationId: ism.get_policy.0_superseded x-operation-group: ism.get_policy - description: Gets the policy. + description: Gets a policy. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#put-policy parameters: - $ref: '#/components/parameters/ism.get_policy::path.policy_id' - $ref: '#/components/parameters/_global::query.pretty' @@ -11562,6 +11934,26 @@ paths: $ref: '#/components/responses/ism.get_policy@200' deprecated: true x-ignorable: true + head: + operationId: ism.exists_policy.0_superseded + x-operation-group: ism.exists_policy + description: Checks whether the policy exists. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#get-policy + parameters: + - $ref: '#/components/parameters/ism.exists_policy::path.policy_id' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.exists_policy@200' + '404': + $ref: '#/components/responses/ism.exists_policy@404' + deprecated: true + x-ignorable: true put: operationId: ism.put_policy.0_superseded x-operation-group: ism.put_policy @@ -11604,15 +11996,35 @@ paths: $ref: '#/components/responses/ism.delete_policy@200' deprecated: true x-ignorable: true - /_opendistro/_ism/remove/{index}: + /_opendistro/_ism/remove: post: operationId: ism.remove_policy.0_superseded x-operation-group: ism.remove_policy description: Removes a policy from an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#remove-policy + parameters: + - $ref: '#/components/parameters/ism.remove_policy::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.remove_policy@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/remove/{index}: + post: + operationId: ism.remove_policy.1_superseded + x-operation-group: ism.remove_policy + description: Removes a policy from an index. externalDocs: url: https://opensearch.org/docs/latest/im-plugin/ism/api/#remove-policy parameters: - $ref: '#/components/parameters/ism.remove_policy::path.index' + - $ref: '#/components/parameters/ism.remove_policy::query.index' - $ref: '#/components/parameters/_global::query.pretty' - $ref: '#/components/parameters/_global::query.human' - $ref: '#/components/parameters/_global::query.error_trace' @@ -11623,6 +12035,49 @@ paths: $ref: '#/components/responses/ism.remove_policy@200' deprecated: true x-ignorable: true + /_opendistro/_ism/retry: + post: + operationId: ism.retry_index.0_superseded + x-operation-group: ism.retry_index + description: Retry the failed action for an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#retry-failed-index + parameters: + - $ref: '#/components/parameters/ism.retry_index::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.retry_index' + responses: + '200': + $ref: '#/components/responses/ism.retry_index@200' + deprecated: true + x-ignorable: true + /_opendistro/_ism/retry/{index}: + post: + operationId: ism.retry_index.1_superseded + x-operation-group: ism.retry_index + description: Retry the failed action for an index. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/ism/api/#retry-failed-index + parameters: + - $ref: '#/components/parameters/ism.retry_index::path.index' + - $ref: '#/components/parameters/ism.retry_index::query.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/ism.retry_index' + responses: + '200': + $ref: '#/components/responses/ism.retry_index@200' + deprecated: true + x-ignorable: true /_opendistro/_knn/stats/{stat}: get: operationId: knn.stats.1_superseded @@ -11775,6 +12230,25 @@ paths: $ref: '#/components/responses/ppl.post_stats@200' deprecated: true x-ignorable: true + /_opendistro/_refresh_search_analyzers/{index}: + post: + operationId: ism.refresh_search_analyzers.0_superseded + x-operation-group: ism.refresh_search_analyzers + description: Refresh search analyzers in real time. + externalDocs: + url: https://opensearch.org/docs/latest/im-plugin/refresh-analyzer/ + parameters: + - $ref: '#/components/parameters/ism.refresh_search_analyzers::path.index' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/ism.refresh_search_analyzers@200' + deprecated: true + x-ignorable: true /_opendistro/_rollup/jobs/{rollupID}: get: operationId: rollups.get.0_superseded @@ -16111,7 +16585,11 @@ components: name: metric description: Limits the information returned to the specified metrics. schema: - $ref: '#/components/schemas/_common:Metrics' + oneOf: + - $ref: '#/components/schemas/cluster.reroute:Metric' + - type: array + items: + $ref: '#/components/schemas/cluster.reroute:Metric' style: form cluster.reroute::query.retry_failed: in: query @@ -16411,10 +16889,7 @@ components: description: Comma-separated list of specific routing values. style: form schema: - type: array - items: - type: string - description: Comma-separated list of specific routing values. + $ref: '#/components/schemas/_common:Routing' explode: true create::path.id: in: path @@ -19777,10 +20252,10 @@ components: description: List of shard health statuses used to limit the request. schema: oneOf: - - $ref: '#/components/schemas/indices.shard_stores:ShardStoreStatus' + - $ref: '#/components/schemas/indices.shard_stores:Status' - type: array items: - $ref: '#/components/schemas/indices.shard_stores:ShardStoreStatus' + $ref: '#/components/schemas/indices.shard_stores:Status' style: form indices.shrink::path.index: in: path @@ -20039,7 +20514,11 @@ components: description: Limit the information returned the specific metrics. required: true schema: - $ref: '#/components/schemas/_common:Metrics' + oneOf: + - $ref: '#/components/schemas/indices.stats:Metric' + - type: array + items: + $ref: '#/components/schemas/indices.stats:Metric' style: simple indices.stats::query.completion_fields: in: query @@ -20422,6 +20901,15 @@ components: schema: $ref: '#/components/schemas/_common:IndexName' style: simple + ism.add_policy::query.index: + name: index + in: query + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' ism.change_policy::path.index: name: index in: path @@ -20432,13 +20920,28 @@ components: schema: $ref: '#/components/schemas/_common:IndexName' style: simple + ism.change_policy::query.index: + name: index + in: query + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' ism.delete_policy::path.policy_id: name: policy_id in: path required: true schema: type: string - ism.explain_index::path.index: + ism.exists_policy::path.policy_id: + name: policy_id + in: path + required: true + schema: + type: string + ism.explain_policy::path.index: name: index in: path description: |- @@ -20454,6 +20957,27 @@ components: required: true schema: type: string + ism.put_policies::query.if_primary_term: + name: if_primary_term + in: query + description: Only perform the operation if the document has this primary term. + schema: + type: number + style: form + ism.put_policies::query.if_seq_no: + name: if_seq_no + in: query + description: Only perform the operation if the document has this sequence number. + schema: + $ref: '#/components/schemas/_common:SequenceNumber' + style: form + ism.put_policies::query.policyID: + name: policyID + in: query + required: true + schema: + type: string + style: form ism.put_policy::path.policy_id: name: policy_id in: path @@ -20474,6 +20998,16 @@ components: schema: $ref: '#/components/schemas/_common:SequenceNumber' style: form + ism.refresh_search_analyzers::path.index: + name: index + in: path + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' + style: simple ism.remove_policy::path.index: name: index in: path @@ -20484,6 +21018,34 @@ components: schema: $ref: '#/components/schemas/_common:IndexName' style: simple + ism.remove_policy::query.index: + name: index + in: query + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' + ism.retry_index::path.index: + name: index + in: path + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' + style: simple + ism.retry_index::query.index: + name: index + in: query + description: |- + Comma-separated list of data streams, indices, and aliases. + Supports wildcards (`*`). + required: true + schema: + $ref: '#/components/schemas/_common:IndexName' knn.delete_model::path.model_id: name: model_id in: path @@ -20700,10 +21262,7 @@ components: description: Comma-separated list of specific routing values. style: form schema: - type: array - items: - type: string - description: Comma-separated list of specific routing values. + $ref: '#/components/schemas/_common:Routing' explode: true knn.search_models::query.scroll: name: scroll @@ -21833,6 +22392,14 @@ components: schema: $ref: '#/components/schemas/_common:Duration' x-version-added: '2.0' + put_script::query.context: + name: context + in: query + description: |- + Context in which the script or search template should run. + To prevent errors, the API immediately compiles the script or template in this context. + schema: + type: string put_script::query.master_timeout: in: query name: master_timeout @@ -21904,7 +22471,7 @@ components: name: search_type description: Search operation type schema: - type: string + $ref: '#/components/schemas/_common:SearchType' style: form reindex_rethrottle::path.task_id: in: path @@ -24942,11 +25509,25 @@ components: application/json: schema: $ref: '#/components/schemas/ism._common:ChangePolicyRequest' + ism.explain_policy: + content: + application/json: + schema: {} + ism.put_policies: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:PutPolicyRequest' ism.put_policy: content: application/json: schema: $ref: '#/components/schemas/ism._common:PutPolicyRequest' + ism.retry_index: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:RetryIndexRequest' knn.search_models: content: application/json: @@ -25347,13 +25928,6 @@ components: type: array items: $ref: '#/components/schemas/_common.query_dsl:FieldAndFormat' - knn: - description: Defines the approximate kNN search to run. - oneOf: - - $ref: '#/components/schemas/_common.query_dsl:KnnQuery' - - type: array - items: - $ref: '#/components/schemas/_common.query_dsl:KnnQuery' rank: $ref: '#/components/schemas/_common:RankContainer' min_score: @@ -26569,6 +27143,10 @@ components: - $ref: '#/components/schemas/flow_framework.errors:ParameterConflictError' - $ref: '#/components/schemas/flow_framework.errors:MaxWorkflowsLimitError' - $ref: '#/components/schemas/flow_framework.errors:WorkflowSaveError' + - $ref: '#/components/schemas/flow_framework.errors:WorkflowParsingError' + - $ref: '#/components/schemas/flow_framework.errors:UnsupportedFieldUpdateError' + - $ref: '#/components/schemas/flow_framework.errors:InvalidTemplateVersionError' + - $ref: '#/components/schemas/flow_framework.errors:TemplateNameRequiredError' flow_framework.create@403: content: application/json: @@ -26711,6 +27289,9 @@ components: - $ref: '#/components/schemas/flow_framework.errors:ParameterConflictError' - $ref: '#/components/schemas/flow_framework.errors:MaxWorkflowsLimitError' - $ref: '#/components/schemas/flow_framework.errors:WorkflowSaveError' + - $ref: '#/components/schemas/flow_framework.errors:InvalidTemplateVersionError' + - $ref: '#/components/schemas/flow_framework.errors:UnsupportedFieldUpdateError' + - $ref: '#/components/schemas/flow_framework.errors:WorkflowParsingError' flow_framework.update@404: description: Template Not Found Error content: @@ -27347,16 +27928,34 @@ components: application/json: schema: $ref: '#/components/schemas/ism._common:DeletePolicyResponse' - ism.explain_index@200: + ism.exists_policy@200: + content: + application/json: + schema: {} + ism.exists_policy@404: + content: + application/json: + schema: {} + ism.explain_policy@200: content: application/json: schema: $ref: '#/components/schemas/ism._common:ExplainIndexResponse' + ism.get_policies@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:GetPoliciesResponse' ism.get_policy@200: content: application/json: schema: $ref: '#/components/schemas/ism._common:GetPolicyResponse' + ism.put_policies@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:PutPolicyResponse' ism.put_policy@200: content: application/json: @@ -27367,11 +27966,21 @@ components: application/json: schema: $ref: '#/components/schemas/ism._common:PutPolicyResponse' + ism.refresh_search_analyzers@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:RefreshSearchAnalyzersResponse' ism.remove_policy@200: content: application/json: schema: $ref: '#/components/schemas/ism._common:RemovePolicyResponse' + ism.retry_index@200: + content: + application/json: + schema: + $ref: '#/components/schemas/ism._common:RetryIndexResponse' knn.delete_model@200: {} knn.get_model@200: {} knn.search_models@200: {} @@ -30341,7 +30950,11 @@ components: - bulk - search _common:Routing: - type: string + oneOf: + - type: string + - type: array + items: + type: string _common:RrfRank: allOf: - $ref: '#/components/schemas/_common:RankBase' @@ -39085,15 +39698,8 @@ components: minProperties: 1 maxProperties: 1 terms: - type: object - additionalProperties: - anyOf: - - $ref: '#/components/schemas/_common.query_dsl:TermsQuery' - - type: array - items: - type: string - minProperties: 1 - maxProperties: 1 + description: Returns documents that contain one or more exact terms in a provided field. + $ref: '#/components/schemas/_common.query_dsl:TermsQueryField' terms_set: description: |- Returns documents that contain a minimum number of exact terms in a provided field. @@ -39601,19 +40207,33 @@ components: type: boolean required: - value - _common.query_dsl:TermsQuery: - anyOf: - - $ref: '#/components/schemas/_common.query_dsl:QueryBase' - - type: object - properties: - index: - $ref: '#/components/schemas/_common:IndexName' - id: - $ref: '#/components/schemas/_common:Id' - path: - $ref: '#/components/schemas/_common:Field' - routing: - $ref: '#/components/schemas/_common:Routing' + _common.query_dsl:TermsLookupField: + type: object + properties: + index: + $ref: '#/components/schemas/_common:IndexName' + id: + $ref: '#/components/schemas/_common:Id' + path: + $ref: '#/components/schemas/_common:Field' + routing: + $ref: '#/components/schemas/_common:Routing' + _common.query_dsl:TermsQueryField: + type: object + properties: + boost: + description: |- + A floating-point value that specifies the weight of this field toward the relevance score. + Values above 1.0 increase the field’s relevance. Values between 0.0 and 1.0 decrease the field’s relevance. + Default is 1.0. + type: number + format: float + additionalProperties: + oneOf: + - $ref: '#/components/schemas/_common.query_dsl:TermsLookupField' + - type: array + items: + type: string _common.query_dsl:TermsSetQuery: allOf: - $ref: '#/components/schemas/_common.query_dsl:QueryBase' @@ -39788,17 +40408,11 @@ components: type: integer format: int32 _core.bulk:CreateOperation: - allOf: - - $ref: '#/components/schemas/_core.bulk:WriteOperation' - - type: object + $ref: '#/components/schemas/_core.bulk:WriteOperation' _core.bulk:DeleteOperation: - allOf: - - $ref: '#/components/schemas/_core.bulk:OperationBase' - - type: object + $ref: '#/components/schemas/_core.bulk:OperationBase' _core.bulk:IndexOperation: - allOf: - - $ref: '#/components/schemas/_core.bulk:WriteOperation' - - type: object + $ref: '#/components/schemas/_core.bulk:WriteOperation' _core.bulk:OperationBase: type: object properties: @@ -44611,6 +45225,18 @@ components: - index - shard - to_node + cluster.reroute:Metric: + type: string + enum: + - _all + - blocks + - cluster_manager_node + - master_node + - metadata + - nodes + - routing_nodes + - routing_table + - version cluster.reroute:RerouteDecision: type: object properties: @@ -45538,6 +46164,8 @@ components: use_case: type: string description: A use case, which can be used with the Search Workflow API to find related workflows. + workflows: + type: object version: $ref: '#/components/schemas/flow_framework.common:version' minProperties: 1 @@ -45838,7 +46466,7 @@ components: application/json: type: object properties: - message: + error: type: string example: You cannot use both the 'provision_workflow' and 'update_workflow_fields' parameters in the same request. status: @@ -45876,7 +46504,7 @@ components: application/json: type: object properties: - message: + error: type: string example: This API is disabled. To enable it, set [flow_framework.enabled] to true. status: @@ -45886,7 +46514,7 @@ components: application/json: type: object properties: - message: + error: type: string example: Only the parameters [param1, param2] are permitted unless the provision parameter is set to true. status: @@ -45900,12 +46528,21 @@ components: status: type: integer description: HTTP status code for the error. + flow_framework.errors:InvalidTemplateVersionError: + content: + application/json: + type: object + properties: + error: + type: string + description: Error message when the template version is invalid or missing. + example: Unable to parse field [version] in a version object. flow_framework.errors:MaxWorkflowsLimitError: content: application/json: type: object properties: - message: + error: type: string example: Maximum workflows limit reached 50 code: @@ -45915,7 +46552,7 @@ components: application/json: type: object properties: - message: + error: type: string example: You cannot use the 'reprovision_workflow' parameter to create a new template. status: @@ -45925,7 +46562,7 @@ components: application/json: type: object properties: - message: + error: type: string example: You cannot use the 'reprovision_workflow' and 'use_case' parameters in the same request. status: @@ -45950,32 +46587,56 @@ components: type: integer description: HTTP status code for the error. example: 408 + flow_framework.errors:TemplateNameRequiredError: + type: object + properties: + error: + type: string + description: Error message when the template name is missing. flow_framework.errors:TemplateNotFoundError: content: application/json: type: object properties: - message: + error: type: string example: Failed to retrieve template (12345) from global context. code: type: integer + flow_framework.errors:UnsupportedFieldUpdateError: + content: + application/json: + type: object + properties: + error: + type: string + description: Error message when trying to update an unsupported field in a template. + example: You can not update the field [fieldName] without updating the whole template. flow_framework.errors:WorkFlowIdNullError: content: application/json: type: object properties: - message: + error: type: string example: Workflow ID can not be null status: type: integer + flow_framework.errors:WorkflowParsingError: + content: + application/json: + type: object + properties: + error: + type: string + description: Error message when workflow parsing fails. + example: Unable to parse field [workflow] in a template object. flow_framework.errors:WorkflowSaveError: content: application/json: type: object properties: - message: + error: type: string example: Failed to save workflow state status: @@ -45985,7 +46646,7 @@ components: application/json: type: object properties: - message: + error: type: string example: Failed to retrieve workflow step json. code: @@ -47629,13 +48290,6 @@ components: required: - reason - type - indices.shard_stores:ShardStoreStatus: - type: string - enum: - - all - - green - - red - - yellow indices.shard_stores:ShardStoreWrapper: type: object properties: @@ -47645,6 +48299,13 @@ components: $ref: '#/components/schemas/indices.shard_stores:ShardStore' required: - stores + indices.shard_stores:Status: + type: string + enum: + - all + - green + - red + - yellow indices.simulate_template:Overlapping: type: object properties: @@ -47755,6 +48416,27 @@ components: - primaries - total - uuid + indices.stats:Metric: + type: string + enum: + - _all + - completion + - docs + - fielddata + - flush + - get + - indexing + - merge + - query_cache + - recovery + - refresh + - request_cache + - search + - segments + - store + - suggest + - translog + - warmer indices.stats:ShardCommit: type: object properties: @@ -49070,6 +49752,8 @@ components: required: - policy_id ism._common:ChangePolicyResponse: + $ref: '#/components/schemas/ism._common:ChangeResponse' + ism._common:ChangeResponse: type: object properties: updated_indices: @@ -49151,10 +49835,17 @@ components: type: string reason: type: string + ism._common:GetPoliciesResponse: + type: object + properties: + total_policies: + type: number + policies: + type: array + items: + $ref: '#/components/schemas/ism._common:PolicyWithMetadata' ism._common:GetPolicyResponse: - allOf: - - $ref: '#/components/schemas/ism._common:Metadata' - - $ref: '#/components/schemas/ism._common:PolicyEnvelope' + $ref: '#/components/schemas/ism._common:PolicyWithMetadata' ism._common:IncludeState: type: object properties: @@ -49218,6 +49909,11 @@ components: properties: policy: $ref: '#/components/schemas/ism._common:Policy' + ism._common:PolicyWithMetadata: + type: object + allOf: + - $ref: '#/components/schemas/ism._common:Metadata' + - $ref: '#/components/schemas/ism._common:PolicyEnvelope' ism._common:PutPolicyRequest: $ref: '#/components/schemas/ism._common:PolicyEnvelope' ism._common:PutPolicyResponse: @@ -49227,8 +49923,35 @@ components: properties: policy: $ref: '#/components/schemas/ism._common:PolicyEnvelope' + ism._common:RefreshSearchAnalyzersResponse: + type: object + properties: + _shards: + $ref: '#/components/schemas/_common:ShardStatistics' + successful_refresh_details: + type: array + items: + $ref: '#/components/schemas/ism._common:RefreshSearchAnalyzersResponseDetails' + ism._common:RefreshSearchAnalyzersResponseDetails: + type: object + properties: + index: + type: string + refreshed_analyzers: + type: array + items: + type: string ism._common:RemovePolicyResponse: $ref: '#/components/schemas/ism._common:ChangePolicyResponse' + ism._common:RetryIndexRequest: + type: object + properties: + state: + type: string + required: + - state + ism._common:RetryIndexResponse: + $ref: '#/components/schemas/ism._common:ChangeResponse' ism._common:SlackCustomWebhook: type: object properties: diff --git a/src/OpenSearch.Net/Api/Enums.cs b/src/OpenSearch.Net/Api/Enums.cs index 708e33253c..5908a4f4f3 100644 --- a/src/OpenSearch.Net/Api/Enums.cs +++ b/src/OpenSearch.Net/Api/Enums.cs @@ -62,45 +62,6 @@ public enum ClusterStateMetric ClusterManagerNode = 1 << 8, } - [Flags, StringEnum] - public enum IndicesStatsMetric - { - [EnumMember(Value = "store")] - Store = 1 << 0, - [EnumMember(Value = "indexing")] - Indexing = 1 << 1, - [EnumMember(Value = "get")] - Get = 1 << 2, - [EnumMember(Value = "search")] - Search = 1 << 3, - [EnumMember(Value = "merge")] - Merge = 1 << 4, - [EnumMember(Value = "flush")] - Flush = 1 << 5, - [EnumMember(Value = "refresh")] - Refresh = 1 << 6, - [EnumMember(Value = "query_cache")] - QueryCache = 1 << 7, - [EnumMember(Value = "fielddata")] - Fielddata = 1 << 8, - [EnumMember(Value = "docs")] - Docs = 1 << 9, - [EnumMember(Value = "warmer")] - Warmer = 1 << 10, - [EnumMember(Value = "completion")] - Completion = 1 << 11, - [EnumMember(Value = "segments")] - Segments = 1 << 12, - [EnumMember(Value = "translog")] - Translog = 1 << 13, - [EnumMember(Value = "request_cache")] - RequestCache = 1 << 14, - [EnumMember(Value = "recovery")] - Recovery = 1 << 15, - [EnumMember(Value = "_all")] - All = 1 << 16 - } - [Flags, StringEnum] public enum NodesInfoMetric { @@ -386,7 +347,6 @@ public static partial class KnownEnums static KnownEnums() { AddEnumStringResolver(GetStringValue); - AddEnumStringResolver(GetStringValue); AddEnumStringResolver(GetStringValue); AddEnumStringResolver(GetStringValue); AddEnumStringResolver(GetStringValue); @@ -438,46 +398,6 @@ public static string GetStringValue(this ClusterStateMetric enumValue) return string.Join(",", list); } - public static string GetStringValue(this IndicesStatsMetric enumValue) - { - if ((enumValue & IndicesStatsMetric.All) != 0) - return "_all"; - var list = new List(); - if ((enumValue & IndicesStatsMetric.Store) != 0) - list.Add("store"); - if ((enumValue & IndicesStatsMetric.Indexing) != 0) - list.Add("indexing"); - if ((enumValue & IndicesStatsMetric.Get) != 0) - list.Add("get"); - if ((enumValue & IndicesStatsMetric.Search) != 0) - list.Add("search"); - if ((enumValue & IndicesStatsMetric.Merge) != 0) - list.Add("merge"); - if ((enumValue & IndicesStatsMetric.Flush) != 0) - list.Add("flush"); - if ((enumValue & IndicesStatsMetric.Refresh) != 0) - list.Add("refresh"); - if ((enumValue & IndicesStatsMetric.QueryCache) != 0) - list.Add("query_cache"); - if ((enumValue & IndicesStatsMetric.Fielddata) != 0) - list.Add("fielddata"); - if ((enumValue & IndicesStatsMetric.Docs) != 0) - list.Add("docs"); - if ((enumValue & IndicesStatsMetric.Warmer) != 0) - list.Add("warmer"); - if ((enumValue & IndicesStatsMetric.Completion) != 0) - list.Add("completion"); - if ((enumValue & IndicesStatsMetric.Segments) != 0) - list.Add("segments"); - if ((enumValue & IndicesStatsMetric.Translog) != 0) - list.Add("translog"); - if ((enumValue & IndicesStatsMetric.RequestCache) != 0) - list.Add("request_cache"); - if ((enumValue & IndicesStatsMetric.Recovery) != 0) - list.Add("recovery"); - return string.Join(",", list); - } - public static string GetStringValue(this NodesInfoMetric enumValue) { var list = new List(); diff --git a/src/OpenSearch.Net/OpenSearch.Net.csproj b/src/OpenSearch.Net/OpenSearch.Net.csproj index eb3905d7d6..0de2c6af25 100644 --- a/src/OpenSearch.Net/OpenSearch.Net.csproj +++ b/src/OpenSearch.Net/OpenSearch.Net.csproj @@ -41,6 +41,7 @@ + diff --git a/src/OpenSearch.Net/_Generated/Api/Enums.cs b/src/OpenSearch.Net/_Generated/Api/Enums.cs index 706c3a6523..35005dd9ce 100644 --- a/src/OpenSearch.Net/_Generated/Api/Enums.cs +++ b/src/OpenSearch.Net/_Generated/Api/Enums.cs @@ -108,6 +108,64 @@ public enum ExpandWildcards Open = 1 << 4, } + [Flags, StringEnum] + public enum IndicesStatsMetric + { + [EnumMember(Value = "completion")] + Completion = 1 << 0, + + [EnumMember(Value = "docs")] + Docs = 1 << 1, + + [EnumMember(Value = "fielddata")] + Fielddata = 1 << 2, + + [EnumMember(Value = "flush")] + Flush = 1 << 3, + + [EnumMember(Value = "get")] + Get = 1 << 4, + + [EnumMember(Value = "indexing")] + Indexing = 1 << 5, + + [EnumMember(Value = "merge")] + Merge = 1 << 6, + + [EnumMember(Value = "query_cache")] + QueryCache = 1 << 7, + + [EnumMember(Value = "recovery")] + Recovery = 1 << 8, + + [EnumMember(Value = "refresh")] + Refresh = 1 << 9, + + [EnumMember(Value = "request_cache")] + RequestCache = 1 << 10, + + [EnumMember(Value = "search")] + Search = 1 << 11, + + [EnumMember(Value = "segments")] + Segments = 1 << 12, + + [EnumMember(Value = "store")] + Store = 1 << 13, + + [EnumMember(Value = "suggest")] + Suggest = 1 << 14, + + [EnumMember(Value = "translog")] + Translog = 1 << 15, + + [EnumMember(Value = "warmer")] + Warmer = 1 << 16, + + [EnumMember(Value = "_all")] + All = 1 << 17, + } + [StringEnum] public enum Level { @@ -152,6 +210,7 @@ static partial void RegisterEnumStringResolvers() { AddEnumStringResolver(GetStringValue); AddEnumStringResolver(GetStringValue); + AddEnumStringResolver(GetStringValue); AddEnumStringResolver(GetStringValue); AddEnumStringResolver(GetStringValue); } @@ -191,6 +250,48 @@ public static string GetStringValue(this ExpandWildcards enumValue) return string.Join(",", list); } + public static string GetStringValue(this IndicesStatsMetric enumValue) + { + if ((enumValue & IndicesStatsMetric.All) != 0) + return "_all"; + var list = new List(); + if ((enumValue & IndicesStatsMetric.Completion) != 0) + list.Add("completion"); + if ((enumValue & IndicesStatsMetric.Docs) != 0) + list.Add("docs"); + if ((enumValue & IndicesStatsMetric.Fielddata) != 0) + list.Add("fielddata"); + if ((enumValue & IndicesStatsMetric.Flush) != 0) + list.Add("flush"); + if ((enumValue & IndicesStatsMetric.Get) != 0) + list.Add("get"); + if ((enumValue & IndicesStatsMetric.Indexing) != 0) + list.Add("indexing"); + if ((enumValue & IndicesStatsMetric.Merge) != 0) + list.Add("merge"); + if ((enumValue & IndicesStatsMetric.QueryCache) != 0) + list.Add("query_cache"); + if ((enumValue & IndicesStatsMetric.Recovery) != 0) + list.Add("recovery"); + if ((enumValue & IndicesStatsMetric.Refresh) != 0) + list.Add("refresh"); + if ((enumValue & IndicesStatsMetric.RequestCache) != 0) + list.Add("request_cache"); + if ((enumValue & IndicesStatsMetric.Search) != 0) + list.Add("search"); + if ((enumValue & IndicesStatsMetric.Segments) != 0) + list.Add("segments"); + if ((enumValue & IndicesStatsMetric.Store) != 0) + list.Add("store"); + if ((enumValue & IndicesStatsMetric.Suggest) != 0) + list.Add("suggest"); + if ((enumValue & IndicesStatsMetric.Translog) != 0) + list.Add("translog"); + if ((enumValue & IndicesStatsMetric.Warmer) != 0) + list.Add("warmer"); + return string.Join(",", list); + } + public static string GetStringValue(this Level enumValue) => enumValue switch { diff --git a/tests/Tests.YamlRunner/DoMapper.fs b/tests/Tests.YamlRunner/DoMapper.fs index 318fda3837..43873c73d9 100644 --- a/tests/Tests.YamlRunner/DoMapper.fs +++ b/tests/Tests.YamlRunner/DoMapper.fs @@ -34,6 +34,7 @@ open System.Collections.ObjectModel open System.Globalization open System.Linq open System.Linq.Expressions +open System.Runtime.Serialization open System.Threading.Tasks open Tests.YamlRunner.Models open OpenSearch.Net @@ -49,6 +50,8 @@ type FastApiInvoke(instance: Object, restName:string, pathParams:KeyedCollection member private this.SupportsBody = pathParams.IndexOf "body" >= 0 member this.PathParameters = pathParams |> Seq.map (fun k -> k) |> Seq.filter (fun k -> k <> "body") |> Set.ofSeq + member private this.ParameterTypes = + methodInfo.GetParameters() |> Array.map (_.ParameterType) member private this.CreateRequestParameters = let t = methodInfo.GetParameters() |> Array.find (fun p -> typeof.IsAssignableFrom(p.ParameterType)) @@ -80,7 +83,17 @@ type FastApiInvoke(instance: Object, restName:string, pathParams:KeyedCollection member private this.toMap (o:YamlMap) = o |> Seq.map (fun o -> o.Key :?> String , o.Value) |> Map.ofSeq - member this.ArgString (v:Object) = + member this.ArgConvert (v:Object, t:Type): Object = + match t with + | t when t = typeof -> this.ArgString v + | t when Nullable.GetUnderlyingType(t) <> null -> + let underlyingType = Nullable.GetUnderlyingType(t) + if v = null then null + else this.ArgConvert(v, underlyingType) + | t when t.IsEnum -> this.ArgEnum(this.ArgString v, t) + | t -> failwithf $"unable to convert argument to type %s{t.FullName}" + + member this.ArgString (v:Object): string = let toString (value:Object) = match value with | null -> null @@ -89,7 +102,7 @@ type FastApiInvoke(instance: Object, restName:string, pathParams:KeyedCollection | :? double as i -> i.ToString(CultureInfo.InvariantCulture) | :? int64 as i -> i.ToString(CultureInfo.InvariantCulture) | :? Boolean as b -> if b then "false" else "true" - | e -> failwithf "unknown type %s " (e.GetType().Name) + | e -> failwithf $"unknown type %s{e.GetType().Name}" match v with | :? List as a -> @@ -99,7 +112,33 @@ type FastApiInvoke(instance: Object, restName:string, pathParams:KeyedCollection | [] -> "_all" | _ -> String.Join(',', values) | e -> toString e - + + member this.ArgEnum (v:String, t:Type): Enum = + let values = Enum.GetValues(t) + + let lookup = + values + |> Seq.cast + |> Seq.map (fun e -> + let field = t.GetField(e.ToString()) + let attr = field.GetCustomAttribute() + let stringValue = if attr <> null then attr.Value else Enum.GetName(t, e) + (stringValue.ToLowerInvariant(), e) + ) + |> Map.ofSeq + + let result = + v.ToLowerInvariant().Split(',') + |> Seq.map (_.Trim()) + |> Seq.map (fun s -> + match lookup.TryGetValue(s) with + | true, e -> e + | false, _ -> failwithf $"unable to find enum value %s{s}" + ) + |> Seq.map Convert.ToInt32 + |> Seq.reduce (fun acc e -> acc ||| e) + + Enum.ToObject(t, result) :?> Enum member this.CanInvoke (o:YamlMap) = let operationKeys = @@ -125,18 +164,7 @@ type FastApiInvoke(instance: Object, restName:string, pathParams:KeyedCollection |> Map.filter (fun k _ -> this.PathParameters.Contains(k)) |> Map.filter (fun _ v -> not <| String.IsNullOrWhiteSpace(this.ArgString v)) |> Map.toSeq - |> Seq.map (fun (k, v) -> - match k with - // category_id is mapped as long (only path param that is not string) - | "category_id" -> - match v with - // Some test use a string e.g "1" - | :? String as v -> (k, Int64.Parse(v) :> Object) - // Yaml reads numbers as int32 - | :? Int32 as v -> (k, Convert.ToInt64(v) :> Object) - | _ -> (k, v) - | _ -> (k, this.ArgString v :> Object) - ) + |> Seq.map (fun (k, v) -> (k, this.ArgConvert (v, this.ParameterTypes[this.IndexOfParam k]))) |> Seq.sortBy (fun (k, _) -> this.IndexOfParam k) |> Seq.map (fun (_, v) -> v) |> Seq.toArray diff --git a/tests/Tests.YamlRunner/SkipList.fs b/tests/Tests.YamlRunner/SkipList.fs index 710869434d..c9cbf0f4e1 100644 --- a/tests/Tests.YamlRunner/SkipList.fs +++ b/tests/Tests.YamlRunner/SkipList.fs @@ -32,6 +32,8 @@ type SkipSection = All | Section of string | Sections of string list type SkipFile = SkipFile of string let SkipList = dict [ + SkipFile "index/91_flat_object_null_value.yml", Section "Supported queries" + // Incorrectly being run due to OpenSearch 1.x/2.x being numerically <7.2.0, but feature-wise >7.10 SkipFile "cat.indices/10_basic.yml", Section "Test cat indices output for closed index (pre 7.2.0)" SkipFile "cluster.health/10_basic.yml", Section "cluster health with closed index (pre 7.2.0)" @@ -45,6 +47,9 @@ let SkipList = dict [ // .NET method arg typings make this not possible, index is a required parameter SkipFile "indices.put_mapping/all_path_options_with_types.yml", Section "put mapping with blank index" + + // argument is an enum in .NET client, meaning invalid value can't be passed + SkipFile "indices.stats/10_index.yml", Section "Indices stats unrecognized parameter" // The client doesn't support the indices.upgrade API SkipFile "indices.upgrade/10_basic.yml", All @@ -58,5 +63,6 @@ let SkipList = dict [ SkipFile "search.aggregation/20_terms.yml", Section "Unsigned Long test" SkipFile "search.aggregation/230_composite_unsigned.yml", All SkipFile "search.aggregation/370_multi_terms.yml", Section "Unsigned Long test" + SkipFile "search.aggregation/410_nested_aggs.yml", Section "Supported queries" SkipFile "search/90_search_after.yml", Section "unsigned long" ]